I have an excel file which has two charts (Bar of pie and Donut Chart). These charts are created through cell reference from other sheets. But, when I am saving the file to PDF, second chart (donut chart) is not rendered in the pdf.
Here's the sample code in Java for Aspose Cells.
import com.aspose.cells.*
class AsposeCellTesting {
public static void main(String[] args) {
generatePDF()
}
public static void generatePDF(){
Workbook workbook = new Workbook(new FileInputStream(new File("new_imp.xlsx")));
println "Number of sheets = ${workbook.getWorksheets().getCount()}"
for (int j = 0; j < workbook.getWorksheets().getCount(); j++) {
if(shouldExclude(workbook.getWorksheets().get(j).getName())){
workbook.getWorksheets().get(j).setVisible(false);
}else{
// do nothing
}
}
workbook.calculateFormula();
workbook.save("DONUT_CHART.pdf");
}
public static Boolean shouldExclude(String sheetName) {
if(sheetName.startsWith("_") || sheetName.contains("staging") ||sheetName.contains("Staging")) {
return true;
}
return false;
}
}
If all data for Donut Chart is available (i.e. 2.0% instead of 0.0%) in the data, the export works fine.
Aspose Cells version : aspose-cells:17.4.0
Excel file can be downloaded here: https://drive.google.com/file/d/1UgFVTAOk3NcvQNdbjWBlf3zTudxjOmTj/view?usp=sharing

