We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

SpreadsheetML - Invalid file format requested


I am trialling Aspose Cells ( using Visual Studio 2005 and Windows XP
I need to be able to load and save Excel 2003 XML Spreadsheet files, and to do this I assume I need to save in the SpreadsheetML FileFormatType.

In a C# web application I have been able to load this format, but when I try to save in theSpreadsheetML format I get the following error:

" System.ArgumentException: Invalid file format requested."

Even if I just create a new workbook I also get this error when I save in that format, although the other file format types all work fine when saving - either new files or loading from existing files.

Here is an example of the code I tried in the click event of a button in an aspx page:

protected void Button1_Click(object sender, EventArgs e)
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells[0, 0].PutValue(“row 1 cell 1”);
workbook.Save(“wrk1.xml”, SaveType.OpenInBrowser, FileFormatType.SpreadsheetML, Response);

Thanks for your help.


Thanks for considering Aspose.

I don't find the problem you have mentioned. I implemented your code and it works fine.

Could you try the latest version / fix ( attached @ the thread: <A href="</A> </P> <P>Thank you.</P>

Thanks for your quick response, but unfortunately the update did not make a difference.

I made sure the dll deployed to the bin directory was I also tried it on another development environment and got the same error.


We have found this issue. We will post a fix soon. Thanks for you patience.


Please try the fix in <A href="</A></P>

Hi Warren,

Although clicking the link you posted produces an error “wlmailhtml is not a registered protocol”, I went to that forum post and installed

I no longer get the original error when I run the example I posted earilier, but now in the test web page where I am clicking the test button it just seems to get posted back as the response, this is what I now see:

Untitled Page

If I change the format type to FileFormatType.Excel2003 for example, then it still works fine.


Please try this fix.


This fix does now generate an xml file, but I am concerned to see that if I view the file in a text editor, the html page that made the request is embeded at the bottom of the file, obviously making it an invalid xml document.

I have also noticed that if I specify the file extension to be “.xml” it is still saved as “.xls”, and that if I try to load a file and then save it, some formatting seems to be lost, such as tab colors.


Please try this fix. We have supported tab color in exporting and importing spreadml.

We call this line code use "application/vnd.ms-excel" as response.ContentType. IE will auto change the extension to ".xls". We tried other Content Type, we found that IE will not call MS Excel to open it if we want to open the file in IE. If you have an idea on Content Type, please tell us.


I think the tab color is now being retained thanks, but was this fix also supposed to fix the problem where the the html page that made the request is embeded at the bottom of the xml file, as I am still seeing this problem?


Please call Reponse.End() method after Wokbook.Save() method to remove the html page which embeded at the xml file..See following codes:

Workbook workbook = new Workbook();
workbook.Save("test.xml", FileFormatType.SpreadsheetML, SaveType.OpenInBrowser, Response);

That works well now, thanks for all your help.