Refresh Charts in Excel spreadsheet without clicking "Enable Editing" with Aspose.Cells

We have charts, graph in our spreadsheet, based on data from another worksheet. We are updating the data programmatically using “aspose.cells” and allowing the user to download this file. The chart and graph are updated only after the user clicks “enable editing” (File is downloaded from internet, Excel always opens it in “Protected Mode”).

@Ajithbabu,

Thanks for your query.

Well, this is due MS Excel’s Protected View feature that opens documents in read-only mode, and disables editing functions or so. There is nothing to do with Aspose.Cells APIs. See the document on how to enable/disable this settings for your reference:
https://support.smartvault.com/ETC/Knowledge_Base_and_Known_Issues/Turn_off_Protected_View_in_Excel_to_improve_performance_of_opening_Excel_documents_from_the_SmartVault_Drive

Hope, this helps a bit.

@Amjad_Sahi

Thanks for your response.
We are not sure if this is because of “Enable Editing”.
Chart or graph showing old values that are in the excel template with the old data. We expect when we update the values/data using aspose it will refresh the chart or graph.
we tried using “CalculateFormula()” which doesn’t help. Is there any way we can refresh the chart or graph immediately after updating the data/values?

@Ajithbabu,

When you click “Enable Editing”, is the chart not updated?

If not, it might be an issue. Kindly do create a simple console application (runnable), zip the project and post us here with all the files, we will check it soon.

@Amjad_Sahi

When I click “Enable Editing” the chart is getting updated. But we need to show the updated chart even before clicking “Enable Editing”. Will you able to help?

@Ajithbabu,

Well, you may try to call Chart.Calculate() before saving the file if it makes any difference.

@Amjad_Sahi

Chart.Calculate() also not working.

@Ajithbabu,

Well, in that case, as I told you earlier it is MS Excel’s behavior and nothing to do with Aspose.Cells, so you will get updated chart when you does click “Enable Editing”. I also asked you to disable the relevant option in MS Excel (see my previous reply and refer to the online document), so the file could be opened without the security check.

@Amjad_Sahi

I am not sure if we can ask our clients to do this adviced approach. Will try and let you know.