夕阳天使迅雷下载,日不落英文歌词,定向增发是什么意思
spire.cloud.excel sdk 提供generalapi接口和workbookapi接口,支持将本地excel和云端excel文档转换为ods, pdf, xps, pcl, ps等格式。本文以将excel表格转为pdf为例,介绍实现格式转换的步骤及方法。
所需工具:spire.cloud.excel.sdk
必要步骤:
步骤1:jar文件下载及导入。可通过“下载中心”获取jar;或者通过maven仓库安装导入,具体参考。
步骤2:id及key获取。需要在创建账号,并在“我的应用”板块中创建应用以获得app id及app key。
步骤3:在将云端excel文档转为pdf时,需要在“文档管理”板块先上传excel文档。
注:在云端创建的账号可免费试用1 万次调用次数及 2g 文档内存。
【示例1】将本地excel文档转换为pdf
import spire.cloud.excel.sdk.apiexception; import spire.cloud.excel.sdk.api.generalapi; import spire.cloud.excel.sdk.model.exportformat; import java.io.file; public class exceltopdf { private static string appid = "app id"; private static string appkey = "app key"; public static void main(string[] args) throws apiexception{ //创建generalapi实例并配置账号信息 generalapi generalapi = new generalapi(appid, appkey); //配置相关参数 string format = exportformat.pdf.tostring(); string inputfilepath = "test.xlsx"; file data = new file(inputfilepath ); string outputfilepath = "topdf.pdf"; string password = null; //调用putworkbookconvert接口将文档保存为pdf generalapi.putworkbookconvert(format,outputfilepath,data, password); } }
【示例2】将云端excel文档转换为pdf
import spire.cloud.excel.sdk.apiexception; import spire.cloud.excel.sdk.api.workbookapi; import spire.cloud.excel.sdk.model.exportformat; import spire.cloud.excel.sdk.model.exportoptions; public class exceltopdf2 { private static string appid = "app id"; private static string appkey = "app key"; public static void main(string[] args)throws apiexception { //创建workbookapi实例并配置账号信息 workbookapi workbookapi = new workbookapi(appid, appkey); //配置相关参数 string name= "test.xlsx"; string outputfilepath = "topdf2.pdf"; string format = exportformat.pdf.tostring(); exportoptions options = null; string storage = null; string inputfolder = "input"; string password = null; //调用putworkbooksaveas接口将文档保存为pdf workbookapi.putworkbooksaveas(name, outputfilepath, format, options, password, storage, inputfolder); } }
文档转换结果可在“文档管理”板块中查看,如下:
(本文完)
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
浅析我对 String、StringBuilder、StringBuffer 的理解
使用IDEA搭建SSM框架的详细教程(spring + springMVC +MyBatis)
Springboot整合freemarker 404问题解决方案
引入mybatis-plus报 Invalid bound statement错误问题的解决方法
网友评论