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

Free Support Forum - aspose.com

Issue with Xml import

data.zip (9.0 KB)

I am attempting to import an xml file into a xmlmap created on a spreadsheet using the following code. However if when i open the output file the data isn’t imported. I can manually import the data but it doesn’t seem to work via Aspose. Any advice?

string lFilePath = @“data\test.xlsx”;
string lXmlPath = @“data\customers.xml”;
using (Workbook lWorkBook = new Workbook(lFilePath))
{
var lWorksheet = lWorkBook.Worksheets.First();
System.Xml.XmlDocument document = new System.Xml.XmlDocument();
document.Load(lXmlPath);
System.IO.Stream stream = new System.IO.MemoryStream();
document.Save(stream);
stream.Position = 0;

                lWorkBook.ImportXml(stream, "Sheet1",0,0);
                
                lWorkBook.Save(@"output.xlsx");
            }

@mackers78,

Please notice, I am able to reproduce the issue as you mentioned by using your resource file(s). I found source XML file is not imported fine to xmlmaps of the workbook. I have logged a ticket with an id “CELLSNET-49118” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

I’m not sure this will help, but if you remove the target namespace out of the xsd then the xml will import fine. Hopefully this can point you to the writer direction for a fix.

@mackers78,

Thanks for sharing your findings. We will evaluate it and it may help to figure out the issue.