Hello,
I've got an excel file with some sales-data. One sheet (called 'Report') shows some totals and graphs. The results in this report sheet are dependent on one parameter (clientname), which can be entered in a specific cell.
I use Aspose cells to open this excel file, put the client name in the right cell, and save the report sheet as a pdf file. My problem is that the values in the report are not recalculated when the clientName cell is changed. Calling the method workbook.CalculateFormula() doesn't help...
I attached the excel I'm using. The source code is copied below. What am I doing wrong?? Or is there something wrong in the excel file?
Kr,
Stijn Van Assche
---
const string clientName = "client2";
var workbook = new Workbook(AppDomain.CurrentDomain.BaseDirectory + "contract templates.xlsx");
// put the client name in excel
workbook.Worksheets["Calculations"].Cells["A3"].PutValue(clientName);
workbook.CalculateFormula(true);
// hide all sheets, except the 'report' sheet
workbook.Worksheets["Sheet1"].IsVisible = false;
workbook.Worksheets["data"].IsVisible = false;
workbook.Worksheets["Calculations"].IsVisible = false;
workbook.Worksheets["Totals"].IsVisible = false;
workbook.Worksheets["Values"].IsVisible = false;
// save to pdf
workbook.Save(string.Format("{0}output_{1}.pdf", AppDomain.CurrentDomain.BaseDirectory, clientName), SaveFormat.Pdf);
---