I open an excel file using c# and it works correctly when I create the file. Then I send (through Internet) the file to someone else to add extra data (basically to fill rows). Then that one sends me the file back. The result is that I cannot open the received file. This code fails:
xlApp = new Microsoft.Office.Interop.Excel.Application();
xlWorkBook = xlApp.Application.Workbooks.Open(PathToFile, System.Reflection.Missing.Value, true); //Read only
It throws an exception:
System.Runtime.InteropServices.COMException: Office detectó un problema con este archivo. No se abra este archivo para ayudar a proteger el equipo.
It is in Spanish, but the translation is something like: Office detected a problem with this file. This file doesn't open to help you protect the PC.
I am a bit lost with this internet protection. Can XML files be dangerous? I created the file without any macro or code. And when reading it I do not need any macro or code to execute. I will just read the text in the cells. So, is there any way to open the file using c# without any risk? I understand that the other end could be mean and add some virus to the file (I don't even know if this is possible) but I just need to open it and read the contents of the cells.