Formula in text field is not calulcated when saving as pdf



it seems there is a problem with calculation of formulas within text fields when workbook is saved as PDF.

Aspose (10.2 KB)

Given example file “TextField.xls” contains a text field that refers to cell H1. Value of cell H1 will be shown in this text field. Ok.
Problem: Modified value will not be shown in text field anymore, if modified workbook is saved as PDF.
Thanks a lot.

Best regards



Thanks for the template file and sample code segment.

When you update some shape’s referenced value, you got to use ShapeCollection.updateSelectedValue() method to refresh the shapes values. See the following sample code that works fine as I tested (you may adjust the code in your custom classes, e.g “AsposeCalcWorkbook” accordingly):
Sample code:

Workbook workbook = new Workbook("f:\\files\\TextField.xls");
		Worksheet worksheet = workbook.getWorksheets().get(0);
		Cell cell = worksheet.getCells().get(0, 7); // Cell H1


		PdfSaveOptions pdfSaveOptions = new PdfSaveOptions(com.aspose.cells.SaveFormat.PDF);
		pdfSaveOptions.setCompliance(PdfCompliance.NONE);"f:\\files\\out1.pdf", pdfSaveOptions);

Hope, this helps a bit.


Hi @Amjad_Sahi,

it works fine! Thanks a lot.

Best regards



Good to know that your issue is sorted out by the suggested line of code. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.