Click here to Skip to main content
15,897,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am generating an Excel file through the API outlined in http://msdn.microsoft.com/en-us/library/office/aa140066(v=office.10).aspx[^]. I believe the file name for this format is XLS.

It is generated and emailed through a Windows Service and not ASP.NET download via browser. But still when I open the attachment it throws a warning in excel that the file is different format than the extension (mimetype) conveys.

I admit that the shell hardening feature is meaningful when I export a HTML and emit as XLS or CSV but I am using a valid spreadsheet XML so can some one help me in understand what is still causing this error to crop up?
Posted
Comments
Kenneth Haugland 3-Apr-13 12:00pm    
ITs a faily old excel format, but your approach for generating the file seems to be cumebersome, at least to me. Since you are using a WCF service, I mean.
Vasudevan Deepak Kumar 3-Apr-13 13:15pm    
What do you recommend for the new formats?

1 solution

Vasudevan Deepak Kumar wrote:
What do you recommend for the new formats?


The XLS Excel format is quite obsolete, but you still can use it. Let's start from the very beginning.

You are recommended to support new XML-based Office formats (such as .DOCX, .XLSX), ECMA-376 standard:
http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats[^],
http://en.wikipedia.org/wiki/Office_Open_XML[^].

You can either use Microsoft Office Interop assemblies which are installed when you install Office components, but you can better do it in a way not depending of Office installation; you can use Open XML SDK:
http://www.microsoft.com/en-us/download/details.aspx?id=30425[^].

Also, the documents are supported by 3rd-party software. Please see my past answers:
Convert Office-Documents to PDF without interop[^],
Need a rather unique WPF text editor control[^],
Hi how can i display word file in windows application using c#.net[^],
Read a word file without using Interop.word dll...Do not want to install word in IIS..[^].

This is another option: http://npoi.codeplex.com/[^].

—SA
 
Share this answer
 
Comments
Kenneth Haugland 3-Apr-13 14:16pm    
Oh yes. %'ed.
Sergey Alexandrovich Kryukov 3-Apr-13 14:23pm    
Thank you, Kenneth, appreci8ed. :-)
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900