| 文件名从 server/service/src/main/java/com/doumee/core/annotation/excel/ExcelToPdfToolNewSev.java 修改 |
| | |
| | | package com.doumee.core.annotation.excel;import java.io.*; |
| | | package com.doumee.core.annotation.excel; |
| | | |
| | | import com.jacob.activeX.ActiveXComponent; |
| | | import com.jacob.com.ComThread; |
| | | import com.jacob.com.Dispatch; |
| | | import com.jacob.com.Variant; |
| | | import org.apache.poi.ss.usermodel.*; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import com.itextpdf.text.Document; |
| | | import com.itextpdf.text.DocumentException; |
| | | import com.itextpdf.text.pdf.PdfWriter; |
| | | |
| | | |
| | | public class ExcelToPdfToolNewSev { |
| | | public class ExcelToPdfToolNew { |
| | | |
| | | /** |
| | | * 浣跨敤jacob瀹炵幇excel杞琍DF |
| | | * |
| | | * @param inputFilePath 瀵煎叆Excel鏂囦欢璺緞 |
| | | * @param outputFilePath 瀵煎嚭PDF鏂囦欢璺緞 |
| | | */ |
| | | public static void jacobExcelToPDF(String inputFilePath, String outputFilePath) { |
| | | |
| | | public static void excelToPdf(String inputFilePath, String outputFilePath) { |
| | | ActiveXComponent ax = null; |
| | | Dispatch excel = null; |
| | | try { |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String inputExcelPath = "D:\\2.xlsx"; |
| | | String outputPdfPath = "D:\\22.pdf"; |
| | | String inputExcelPath = "D:\\3.xlsx"; |
| | | String outputPdfPath = "D:\\33.pdf"; |
| | | |
| | | jacobExcelToPDF(inputExcelPath, outputPdfPath); |
| | | excelToPdf(inputExcelPath, outputPdfPath); |
| | | } |
| | | } |