Hello,
Greeting from E-iceblue.
I have some message to inform you according to our development team:
1) For the date format issue and number format issue, our development team modified the logic of Spire.Xls, now, you doesn’t set local in your code to avoid the number format issue, and at the same time, the date format issue caused by setting local to “zh_CN” has also been resolved.
2) For the issue(SPIREXLS-4326) of the Age column values are calculated wrongly: For the excel file downloaded from website, there will have warning message and the formula in excel file will not be calculated, as shown in the screenshot below. That mean the data of Age column is 1 smaller before calculation than fater calculation. Therefore , if you want the data of Age column to be the calculated value in result PDF file, you need
change :- Code: Select all
workbook.getConverterSetting().isReCalculateOnConvert(false);
to: - Code: Select all
workbook.getConverterSetting().isReCalculateOnConvert(true);
I put the complete code below for your reference, and I put the temporary package that includes fixes of theses above issues to our server, you can download it from the following link and have a test.
temporary package:
https://www.e-iceblue.com/downloads/Tem ... 7.12.1.zip - Code: Select all
public static void main(String[] args) {
convertExcelToPdf();
}
public static void convertExcelToPdf() {
File file = new File("data/hockeyplayerdata2018.xlsx");
String outputFileName = "output/hockeyplayerdata2018_12_11_8.pdf";
Workbook workbook = new Workbook();
workbook.loadFromFile(file.getPath());
workbook.getConverterSetting().setSheetFitToWidth(true);
workbook.getConverterSetting().isReCalculateOnConvert(true);
for (int i = 0; i < workbook.getWorksheets().size(); i++) {
Worksheet worksheet = workbook.getWorksheets().get(i);
for (int col = worksheet.getFirstColumn(); col <= worksheet.getLastColumn(); col++){
CellStyle style = worksheet.getColumns()[col-1].getCellStyle();
style.setShrinkToFit(true);
style.setWrapText(false);
}
PageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintArea(null);
}
workbook.saveToFile(outputFileName, FileFormat.PDF);
workbook.dispose();
System.out.println("processed excel file - "+file.getName());
}
Sincerely
Abel
E-iceblue support team