SpreadsheetML document opening issue with namespace attributes

I'm trying to convert an Excel spreadsheet that has been created using XML/XSLT, and the resulting spreadsheet XML has namespace declarations in it, which Aspose.Cells chokes on when I load it.

Here's the code I'm using:

Workbook xls = new Workbook(FileFormatType.Excel2003XML);

xls.Open("Input.xls");

xls.Save("AsposeOutput.xslx", FileFormatType.Excel2007Xlsx);

The Input.xls file starts as follows:

<?xml version="1.0"?>

<?mso-application progid="Excel.Sheet"?>

<Workbook xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">

<Styles xmlns:exsl="http://exslt.org/common" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:user=www.javascript.net>

This code generates the unhandled exception during the xls.Open call:

Line 4: Invalid tag "exsl"

Is there a way to get this to load without modifying the source?

Hi,

Please post your template file. We will check it soon.

The original document is 0.5 MB and contains confidential information, so I stripped it way down and still get the error on the namespace.

My actual goal here is to take some spreadsheetML 2003 spreadsheets and make them viewable on an iPhone. Is this a good approach?

Thanks,

Karl

Hi,

Thanks for the template file.

I have found the issue as you have mentioned. I have logged your issue into our issue tracking system with an id: CELLSNET-19942. We will figure it out soon.

Thank you.

Hi,

Please try the attached version.

We have fixed the issue.

Thank you.

Hi-

Thanks so much for your quick turnaround. That did indeed fix that issue. I am still having trouble where my resulting file opens fine in Excel 2007 but if I send it to my outlook account my iPhone cannot open it, stating "This document can't be viewed. An error occurred while reading the document." Any ideas here?

Here is my changed code with the new interfaces:

LoadOptions options = new LoadOptions(LoadFormat.SpreadsheetML);

Workbook xls = new Workbook("Copy of Original Input.xls",options);

xls.Save("AsposeOutput.xlsx", SaveFormat.Xlsx);

Hi Karl,

Please use the code in the following way:

LoadOptions options = new LoadOptions(LoadFormat.Excel97To2003);

Workbook xls = new Workbook("Copy of Original Input.xls",options);

xls.Save("AsposeOutput.xlsx", SaveFormat.Xlsx);

Thanks,

Hi Salman,


When I change my code to your LoadOptions suggestion of LoadFormat.Excel97To2003, I get the following CellsException: This file’s format is not supported or you don’t specify a correct format.

The input is Spreadsheet XML as follows:

<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
Account Fund Status
Report Type: Customer
<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

<![endif]–>

Hi,

Well, your file is a spreadsheetML file, so, the options should be LoadOptions options = new LoadOptions(); Or LoadOptions options = new LoadOptions(LoadFormat.SpreadsheetML);

Since you could not open the file in iPhone, please open the generated file and save it in MS Excel 2007, then check whether iPhone can open it or not.


Thanks.

The issues you have found earlier (filed as 19942) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.