Last post Mar 27, 2013 03:16 PM by Garcam
Mar 27, 2013 12:56 PM|Garcam|LINK
Hello, I am starting to code in .NET and expermineting I came across a question:
¿How to generate files (in particular Word and Excel) from an html page?
I have experience coding in PHP and I remember, for example to generate an user report, you have to include in your html the headers to specify the document type, and when the user clicks the link it opens a new tab or window, and automatically it open a
dialog box and the user should select the directory to save the document.
Now, is it the same for an aspx page? can you post an example?
Note: I am using VS 2012 with C# because of this I have two files (Word.aspx and Word.aspx.cs), I dont know if that changes the way to specify the headers or document type.
Thanks for your precious help.
Mar 27, 2013 03:16 PM|Garcam|LINK
I found the following answer to my question:
Generating Ms Word document in ASP.NET and C#
Just must to add the following code:
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
Right before of:
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />