0

I use the Gembox.Spreadsheet dll to convert a Excel document to PDF by:

ExcelFile.Load(formExcelPath).Save(formPdfPath);

Which works as expected except for one thing: values which are calculated from formulas show up in the PDF as if they were never calculated.

enter image description here

From Gembox's site , it says "Formulas can't be exported to CSV, HTML, PDF or XPS file formats."

However, I do not want to export the formulas, I just want the values present in the cell. Is there a workaround for this? Some way of forcing formulas to be calculated before the conversion to PDF?

JWiley
  • 3,129
  • 8
  • 41
  • 66
  • While I'm unfamiliar with Gembox it seems you will have to a) use Excel's native *Save as PDF* (2010 and higher), b) print to PDF using one of the freely available PDF print 'drivers' or c) convert all formulas to values with something like *Copy, Paste Special, Values* to revert the formulas to the values they return. –  Mar 26 '15 at 19:19
  • Could you elaborate on option b? And how that would resolve the formula dilemma? – JWiley Mar 26 '15 at 19:43
  • A PDF print 'driver' creates a PDF file by 'printing' to it just as you would any other printer except you end up with a PDF instead of a piece of paper. If you can print a piece of paper that gives you what you want then you can use a 'print-to-PDF' print driver. Years ago I would rely on [BullPDF](http://www.bullzip.com/). There are dozens of others. –  Mar 26 '15 at 19:50
  • You could also look at [GemBox Retrieving Calculated Values From a Spreadsheet or Flexcel](http://stackoverflow.com/questions/8395151/gembox-retrieving-calculated-values-from-a-spreadsheet-or-flexcel?rq=1) which appears to be the original to your question except that it was never marked with an accepted answer. –  Mar 26 '15 at 20:01

1 Answers1

1

EDIT 28-09-2016:
We have released a new version of GemBox.Spreadsheet (version 4.1) in which we implemented a support for cell formula calculation, see the version history page.
Also, you can find the calculation example here.

ORIGINAL ANSWER
Unfortunately the problem is that currently GemBox.Spreadsheet (version 3.9) does not have a calculation engine. In other words it is able to read the last calculated values from the input file, but it's unable to recalculate formula results on its own. Note that we do have this feature request in our collection and please feel free to vote for it in order to boost its priority.

But at this moment I cannot tell you exactly when it will be implemented, this feature is not in our current roadmap.

GemBox Dev Team
  • 669
  • 5
  • 18