Why the Spreadsheet XML file cannot open by Aspose.Cells.Workbook

We use excel component to edit excel file and we can get the spreadsheet XML by call excelObj.XMLData.

But the returned XMLData cannot be loaded by Aspose.Cells.Workbook.

I attached the spreadsheet XML file in this thread.

Thanks a lot!

Hi,

Could you try to read the xml data to fill a dataset using ADO.NET APIs if it works and then use Aspose.Cells's APIs especially Cells.ImportDataTable() to extract data into the spreadsheet.

e.g..,

DataSet ds = new DataSet();
ds.ReadXml(xmlfile);
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
cells.ImportDataTable(ds.Tables[0], true, "A1");
workbook.Save("f:\\test\\mybook.xls");

Thank you.

Hi,

Well, since you are using Javascript code and your file is native spreadsheet xml file, so ignore my previous reply. I have tried and tested the scenario using an .asp file (server side javascript code) in an IIS environment. I use the following code and it works fine, attached is the generated file.

Sample code:

var workbook = new ActiveXObject("Aspose.Cells.Workbook");
workbook.Open_6("f:\\test\\F8P2EK707BFHDEG02OBO8PAC.xml", 10);
var sheet
sheet = workbook.Worksheets.item(0);
var cells
cells = sheet.Cells();
var cell
cell = cells.item_3("C26");
cell.PutValue_5("Hello World!");

workbook.Save_4("f:\\test\\F8P2EK707BFHDEG02OBO8PAC_out.xls");

Thank you.