c# - Is it possible to output .XLSX file with XSLT in ASP.NET Response -


I currently have a .xsl file which I am using as an XSLT output as an .xls file I open it with Excel.

I am outputting the feedback object in an ASP.NET application as follows:

  context.response.ContentType = "application / vnd.ms-excel"; Context.Response.AddHeader ("Content-Properties", "Inline; File Name = MyFile.xml");   

However, it outputs the file as an .xsl extension and displays the following popup message: "The file you are trying to open, 'MyFile.xls ', In a different format is specified by file extension.Verify that the file is not corrupt and is from a trusted source before opening the file. Do you want to open it now? "

I Trying to know two things Yes, I it is possible to output as a .xlsx extension? Because when I try to do this and change the content type, I do not allow the file to open until I set the expansion back into .xls. Second

Second, is this how you get rid of the code by changing the message that? I have received some feedback that gives you instructions to change the settings here:

However, the client requests that the error message is not displayed at all. Any help is appreciated here, thanks.

Do not use XSLT to create an XLSX file, because it is not a simple XML file Is because someone has said. You can use NPOI to create XLS files, ExcelPackage or ClosedXML to produce XLSX files. More work, but it is actually possible.

Comments