Hello Aspose Team,
When we tried to generate a PDF file through template/excel file, we encountered the deadlock type condition/error while calculateFormula() operation performed on the workbook. PDF generation works fine if we do not invoke the calculateFormula() method/API on the workbook but we are required to use that api. Sample template/excel file and executable code are as follows.
Sample Template/Excel file: sampleTemplate.zip (281.1 KB)
Sample Code:
public static void generatePDF() {
FileInputStream io = new FileInputStream(new
File("/home/brpokharel/Documents/sampleTemplate.xlsx"));
Workbook workbook = new Workbook(io);
println " Before=====calculateFormula()1111"
workbook.calculateFormula();
println " After=====calculateFormula()"
// workbook.save("FullTemplate_PdfService.xlsx");
for (int m = 0; m < workbook.getWorksheets().getCount(); m++) {
workbook.getWorksheets().get(m).getShapes().updateSelectedValue();
}
for (int j = 0; j < workbook.getWorksheets().getCount(); j++) {
if (shouldExclude(workbook.getWorksheets().get(j).getName())) {
System.out.println("worksheetName need to EXCLUDE----->>>> " + workbook.getWorksheets().get(j).getName());
workbook.getWorksheets().get(j).setVisible(false);
} else {
System.out.println("worksheetName need to REMOVE EXTRA ROW=======>>> " + workbook.getWorksheets().get(j).getName());
removeBlankRowsAndColumns(workbook.getWorksheets().get(j));
removeBlankColumns(workbook.getWorksheets().get(j));
}
}
//Perform fomula calculation
// workbook.calculateFormula();
workbook.save("PDF_Result_file22.pdf");
int worksheetCount = workbook.getWorksheets().getCount();
int count = 0;
for (int i = 0; i < worksheetCount; i++) {
String worksheetName = workbook.getWorksheets().get(i).getName();
System.out.println("worksheetName = " + worksheetName);
if (worksheetName.startsWith("_")) {
System.out.println(count++);
}
}
}
Could you please look into this from your side.