1

By default, the .xlsx file we generated from my server will be openned in Protected Mode on user's computers. On that mode, I noticed many cells with formulas will not be activated so nothing will be displayed on those cells. Everything is fine on Edit mode. So I want to ask if there is any way to programmatically allow cell formulas to work on Protected Mode? My development environment is MVC4 and I use ExcelCreator 8.0 to generate excel files.

*Edit: My main concern is to display the values of the cells with formulas. They are just some simple SUM() formulas. I noticed that when the first time the file is openned, those cells are blank. But when I switched to Edit Mode for the first time and without editing, immediately save the file then the next time I open it on the Protected Mode, those cells have some values to display. So can we at least program it to save those values without openning on Edit mode first?

Lê Sỹ Hoàng
  • 409
  • 1
  • 3
  • 15
  • 1
    I doubt that it is possible - https://support.office.com/en-us/article/What-is-Protected-View-d6f09ac7-e6b9-4495-8e43-2bbcdbcb6653. That is what the Protected Mode is designed for - to prevent anything potentially malicious from execution. Other than by relaxing the end users' security settings - http://www.askvg.com/how-to-disable-protected-view-in-microsoft-office-while-opening-email-attachments-or-downloaded-files/ there probably is nothing you can do. – Eugene Podskal Feb 23 '16 at 09:48
  • 1
    What are you asking for, I believe, would negate the purpose of Protected Mode. The reason the document opens in protected mode is because it is being generated/opened from a location that is deemed unsecured in the same way that word documents you download from the internet or get e-mailed often open in protected mode. It's just a feature of Office designed to protect the user. – Pheonyx Feb 23 '16 at 09:49
  • I see. My main concern is to display the values of the cells with formulas. They are just some simple SUM() formulas. I noticed that when the first time the file is openned, those cells are blank. But when I switched to Edit Mode for the first time and without editing, immediately save the file then the next time I open it on the Protected Mode, those cells have some values to display. So can we at least program it to save those values without openning on Edit mode first? – Lê Sỹ Hoàng Feb 23 '16 at 09:57

1 Answers1

2

Protected mode prevents the (re-)calculation of formulas in Excel. There are two possible solutions:

  • Disabling protected mode: This is definitely not recommended as it opens a huge attack surface on the clients. Besides, it might be beyond what you can control.
  • Pre-calculating the formula results: When you generate the spreadsheet server-side, you can pre-calculate the results of the formula and fill the cells with the results. That way, Excel will show the correct values even when opening the document in protected view. If calculating the formula yourself is too complicate, using Excel Services might be another, though costly option.
Dirk Vollmar
  • 172,527
  • 53
  • 255
  • 316