Converted pdf have not actual formula values for when formula has DCOUNT and DSUM function

The converted pdf has no formula values when the formula has DCOUNT and DSUM functions. I have attached an Excel file, an Aspose-converted PDF, and a native app-converted PDF. Same is happening for the xlt files too.
Archive.zip (91.1 KB)

@pankaj1983,

After an initial test, I am able to reproduce the issue as you mentioned by using the following sample code with your template XLT and XLSX files. I found DCOUNT and DSUM functions are not calculated properly in the converted PDF.
e.g.
Sample code:

Workbook workbook = new Workbook("f:\\files\\DatabaseFunc_Excel97-2004.xlt");
//Workbook workbook = new Workbook("f:\\files\\xlsx_DatabaseFunc_Excel97-20045.xlsx");
workbook.calculateFormula();
workbook.save("f:\\files\\out1.pdf");

We need to evaluate your issue in details. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSJAVA-45682

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@pankaj1983

From the formulas in your template file, we found the criteria range(J1:K2) used for DSUM and DCOUNT functions is not the common format of “FieldName/FieldIndex”&“FieldValues” pair. Instead it seems the criteria is got from the parameters of COUNTIF functions(formulas of J2 and K2). We cannot find any technical articles about such kind of usage for DSUM and DCOUNT functions. Would you please provide some information(such as technical articles) about the rules of parsing criteria for such kind of formulas in your template file? That would be much helpful for us to fix the issue soon. Thank you.

We are evaluating the software for PDF conversion. This is one sample test data file we got from the team. We found some other software/SDK are able to get proper PDF from this file whereas Aspose SDK is not. Since we don’t know what kind of MS file we encounter in the production so we are testing with all the possible kind of data

@pankaj1983
Thank you for your feedback. We will further investigate it. Once there are updates, we will notify you immediately.

@pankaj1983
We will try to investigate the rules for calculating such kind of formulas soon. If you are evaluating the feature of saving PDF, we think currently you may remove the step of calculating formula. Instead, you may just load the workbook from the template file and then save it to PDF directly:

Workbook workbook = new Workbook("f:\\files\\DatabaseFunc_Excel97-2004.xlt");
workbook.save("f:\\files\\out1.pdf");

What is the use of pdfSaveOptions.setCalculateFormula(true) of PdfSaveOptions class?

@pankaj1983
PdfSaveOptions.setCalculateFormula(boolean value) method indicates whether to calculate formulas before saving pdf file. If set to true, Aspose.Cells will first call the formula calculation before saving file to pdf. This is the same as manually calling the Workbook.CalculateFormula() method before saving.

If I just want to convert Excel to PDF, I don’t need to call the " PdfSaveOptions.setCalculateFormula(boolean value)" since I am not making any changes in the formula or value programmatically correct?

I just wanted to make sure that Aspose PDF contains the values, not the formula.

So the below lines are good to achieve what I mentioned above:

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setWarningCallback(new CellsWarningCallback());

workbook.save(outputPath, pdfSaveOptions);

@pankaj1983
Your understanding and sample code are both correct.