91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 36.2MB
    文件類型: .zip
    金幣: 2
    下載: 16 次
    發布日期: 2023-07-17
  • 語言: Java
  • 標簽: Aspose??word??excel??ppt??pdf??

資源簡介

aspose-slides-18.7.jar 用來將ppt文件轉為pdf aspose-cells-18.9.jar 用來將excel文件轉為pdf aspose-words-18.6.jar 用來將word文件轉為pdf 破解版親測沒有水印。jar包和license.xml都在工程的lib目錄里。

資源截圖

代碼片段和文件信息

package?com.testpoi;

import?com.aspose.cells.Workbook;
import?com.aspose.slides.Presentation;
import?com.aspose.words.Document;

import?java.io.File;
import?java.io.FileInputStream;
import?java.io.FileOutputStream;
import?java.io.InputStream;


/**
?*?Created?by?tanly?on?2018/10/18?0018.
?*/
public?class?OfficeToPDF?{

public?static?boolean?getLicense(String?type)?{
boolean?result?=?false;
try?{
File?file?=?new?File(“C:/Users/jianan/Desktop/asp/bbb.xml“);
InputStream?is?=?new?FileInputStream(file);
if?(type.equals(“excel“))?{
com.aspose.cells.License?aposeLic?=?new?com.aspose.cells.License();
aposeLic.setLicense(is);
}?else?if?(type.equals(“ppt“))?{
com.aspose.slides.License?aposeLic?=?new?com.aspose.slides.License();
aposeLic.setLicense(is);
}?else?{
com.aspose.words.License?aposeLic?=?new?com.aspose.words.License();
aposeLic.setLicense(is);
}
result?=?true;
}?catch?(Exception?e)?{
e.printStackTrace();
}
return?result;
}

public?static?void?main(String[]?args)?{
String?rootPath?=?“C:/Users/jianan/Desktop/asp“;
File?dir?=?new?File(rootPath?+?“/source/“);
File[]?all?=?dir.listFiles();
if?(all?==?null)?{
return;
}
for?(File?sfile?:?all)?{
String?fileType?=?sfile.getName().substring(sfile.getName().lastIndexOf(“.“)?+?1?sfile.getName().length());
if?(“docx“.equals(fileType)?||?“doc“.equals(fileType)?||?“rtf“.equals(fileType)?||?“txt“.equals(fileType))?{
if?(getLicense(“word“))?{//WORD
try?{
long?start?=?System.currentTimeMillis();
File?pdfFile?=?new?File(rootPath?+?“/target/“?+?sfile.getName().substring(0?sfile.getName().lastIndexOf(“.“))?+?“.pdf“);
FileOutputStream?os?=?new?FileOutputStream(pdfFile);
Document?doc?=?new?Document(sfile.getAbsolutePath());
doc.save(os?com.aspose.words.SaveFormat.PDF);
System.out.println(“固化:“?+?fileType?+?“?耗時:“?+?((System.currentTimeMillis()?-?start)?/?1000.0)?+?“秒“);
}?catch?(Exception?e)?{
e.printStackTrace();
}
}?else?{
System.out.println(“WORD證書失敗“);
}
}?else?if?(“xls“.equals(fileType)?||?“xlsx“.equals(fileType)?||?“xlsm“.equals(fileType))?{
if?(getLicense(“excel“))?{//EXCEL
try?{
long?start?=?System.currentTimeMillis();
Workbook?wb?=?new?Workbook(sfile.getAbsolutePath());
File?pdfFile?=?new?File(rootPath?+?“/target/“?+?sfile.getName().substring(0?sfile.getName().lastIndexOf(“.“))?+?“.pdf“);
FileOutputStream?fileOS?=?new?FileOutputStream(pdfFile);
wb.save(fileOS?com.aspose.cells.SaveFormat.PDF);
System.out.println(“固化:“?+?fileType?+?“?耗時:“?+?((System.currentTimeMillis()?-?start)?/?1000.0)?+?“秒“);
}?catch?(Exception?e)?{
e.printStackTrace();
}
}?else?{
System.out.println(“EXCEL證書失敗“);
}
}?else?if?(“ppt“.equals(fileType)?||?“pptx“.equals(fileType)?||?“pps“.equals(fileType))?{
if?(getLicense(“ppt“)

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-04-18?14:42??lib\
?????文件?????6663081??2018-10-13?17:38??lib\aspose-cells-18.9.jar
?????文件????24989136??2018-08-22?11:17??lib\aspose-slides-18.7.jar
?????文件????10571534??2018-08-22?08:48??lib\aspose-words-18.6.jar
?????文件?????????584??2019-04-18?14:14??lib\license.xml
?????目錄???????????0??2019-04-18?10:43??src\
?????目錄???????????0??2019-04-18?10:43??src\main\
?????目錄???????????0??2019-04-18?10:45??src\main\java\
?????目錄???????????0??2019-04-18?10:45??src\main\java\com\
?????目錄???????????0??2019-04-18?14:38??src\main\java\com\testpoi\
?????文件????????3892??2019-04-18?14:15??src\main\java\com\testpoi\OfficeToPDF.java
?????目錄???????????0??2019-04-18?10:43??src\main\resources\
?????目錄???????????0??2019-04-18?10:43??src\test\
?????目錄???????????0??2019-04-18?10:43??src\test\java\
?????文件????????1794??2019-04-18?14:50??pom.xml

評論

共有 條評論