My spreadsheet contains formulas. When the spreadsheet is opened, the cells that contain a formula display "0" instead of the formula output number. The top of the Excel 2010 window states "Protected View This file originated from an Internet location and might be unsafe. Click for more details. Enable Editing
Once enable editing is clicked the cells that displayed "0" now display the correct formula output numbers.
So I have two questions:
1. Is there a way to display formula output numbers without having to click Enable Editing?
2. Is there code I can add that would disable the "Protected View" so that clients could edit spreadsheet without having to click Enable Editing?
Hi Enes Karagic,
Thanks for using Syncfusion products.
We can save the file with evaluated value of the formula by Enable sheet calculations. We have shared the code snippet for enable worksheet calculations below. Please make use of this and let us know if this helps you.
Workaround Code snippet:
workbook = application.Workbooks.Create();
IWorksheet sheet = workbook.Worksheets;
sheet.Range["A2"].Number = 1;
sheet.Range["A3"].Formula = "=A2";
When downloading the file from internet, MS Excel opens in protect mode for security propose. And so we don’t provide any option to disable the protected view in XlsIO.
Thanks for your patience. Please let us know if you need any clarifications.
Thank you for the response, solved my problem for coded reports. The only time enabling sheet calculations is a problem is when I try to apply it to template reports. Is there something different that I have to do?
Hi Enes Karagic,
Thanks for your patience.
The above reported query is not clear enough to understand as there is no more details about your sample scenario. Could you please share us some more details about your query and your sample scenario?
Thank you very much for your patience. Please let us know if you need any clarifications.
string dummy = null;
foreach (IRange range in worksheet.UsedCells)
dummy = range.CalculatedValue;