Spire.XLS is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Tue Dec 13, 2011 1:12 pm

Hello,
I want to load an XML file and save it as xlsx. Can you help me, it does not work!
[list=]
sPath = g_sExport & "\" & Me.Name & ".XML"
sFinal = g_sExport & "\" & Me.Name & ".Xlsx"
Dim workbook As Workbook = New Workbook()
workbook.LoadFromXml(sPath)
workbook.SaveToFile(sFinal, ExcelVersion.Version2007)
[/list]

Thank you in advance,
greetings
Muller Guy

gmuller@vonet.ch
 
Posts: 8
Joined: Wed Mar 23, 2011 10:58 am

Wed Dec 14, 2011 6:54 am

Hello gmuller,

Thank you for your inquiry.

Please try the following code to achieve your functionality.
Code: Select all
           Workbook workbook = new Workbook();

            //Initailize worksheet
            using (FileStream fileStream = File.OpenRead(@"..\..\ReadXMLSample.Xml"))
            {
                workbook.LoadFromXml(fileStream);
            }

            workbook.SaveToFile(@"..\..\Test.xlsx", ExcelVersion.Version2010);
            System.Diagnostics.Process.Start(@"..\..\Test.xlsx");



If you still have any other questions, please don't hesitate to contact us.
Have a nice day.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Thu Feb 01, 2018 2:00 pm

Hi,

I have downloaded free trial version to test LoadFromXml file in Spire.Xls.

It says LoadFromXml doesn't exist in current dll. exe is spire.xls-fe_7.9

lovesha
 
Posts: 1
Joined: Thu Feb 01, 2018 1:50 pm

Fri Feb 02, 2018 3:27 am

Dear lovesha,

Thanks for your inquiry.
Free Spire.XLS for .NET Version:7.9 has the method LoadFromXml, please make sure you are using correct version, and below is dlls information for checking.
Spire.Common.dll V1.2.366.55040
Spire.License.dll V1.3.5.40
Spire.XLS.dll V7.9.0.5504
Spire.Pdf.dll V3.6.230.55040

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Feb 05, 2018 8:49 am

Dear lovesha,

Greetings from E-iceblue.
Has your issue been resolved ? Could you please give us some feedback at your convenience ?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu May 16, 2019 3:21 am

Hi,

I want to convert XML to Excel and when I was trying to use the code which you provided over here, got a below error at LoadFromXMl

sprᡲ: 'Error occured when parse : strict. Detailed: Invalid file format.'

When the same is used for drag and drop in excel, it's working.

Please suggest me to resolve the issue.

Durgaraman
 
Posts: 1
Joined: Thu May 16, 2019 3:08 am

Thu May 16, 2019 3:41 am

Hello Durgaraman,

Thank you for contacting.
After an initial test with our latest Spire.XLS Pack(Hotfix) Version:9.5.4, I didn't reproduce your issue. Thus, I suggest that you download the latest version and try again. If the error still occurs after trying, please share us with your input Xml file to help further look into your issue. You could send it to us via email (support@e-iceblue.com).

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1155
Joined: Wed Apr 25, 2018 3:20 am

Fri May 24, 2019 9:17 am

Hello Durgaraman,

Greetings from E-iceblue.
Could you please let us know how is the issue going? Thanks in advance for your valuable feedback and time.

Sincerely,
Lisa
E-icbelue support team
User avatar

Lisa.Li
 
Posts: 1155
Joined: Wed Apr 25, 2018 3:20 am

Wed Aug 05, 2020 8:29 am

Hi ,

I have created the .XML from Datatable , I have to make .XML to .ODS , but it gives me the error

: Invalid file format.

I am using the code

Spire.Xls.Workbook wb = new Spire.Xls.Workbook();
using (FileStream fileStream = File.OpenRead(strFilePath + "\\test.XML"))
{
wb.LoadFromXml(fileStream);
}

Regards,
Shekhar

Shekhar_123
 
Posts: 1
Joined: Wed Aug 05, 2020 8:24 am

Wed Aug 05, 2020 9:43 am

Hi Shekhar,

Thanks for your inquiry.
To help us investigate your issue more accurately and quickly, please share your input file with us. You could upload here or send it to us (support@e-iceblue.com) via email. Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1573
Joined: Tue Jul 09, 2019 2:22 am

Wed Aug 12, 2020 1:36 am

Hi Shekhar,

Greetings from E-iceblue!
How is your issue now? If it still bothers you, please provide more information to help us investigate further. Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1573
Joined: Tue Jul 09, 2019 2:22 am

Mon Apr 25, 2022 3:19 am

using (Stream fileStream = File.OpenRead(inputFilePath))
{
workbook.LoadFromXml(fileStream);
}

Error: "strict. Detailed: Invalid file format."

I am getting this error while uploading from xml file and I noticed that some of the data is not in text format.

Note: The xml contains the strings, date and numbers. If only contains string its working fine.

imoham20
 
Posts: 4
Joined: Mon Apr 25, 2022 3:13 am

Mon Apr 25, 2022 8:44 am

Hi,

Thank you for your inquiry.
I simulated an XML document (contain date, numbers and strings) to test, but did not reproduce your problem. If you were not using the latest version (Spire.Xls Pack(Hotfix) Version:12.4.1), I would suggest you give the latest one a try. If the issue still happens, please provide the following information for further investigation. You can attach your document here or send it to us via email (support@e-iceblue.com). Thank you in advance.
1) Your XML document
2) Test environment, such as Win10, 64bit
3) Application type, such as Console App, .NET Framework 4.8

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 388
Joined: Mon Mar 07, 2022 2:30 am

Mon Apr 25, 2022 5:37 pm

Hi, I tried with latest package install still its not working
1)Attached sample document
2) Test environment: Win10, 64bit
3) Application type : .net api .NET Framework 4.8
Attachments
XLSFolder.zip
Attached xml file
(14.02 KiB) Downloaded 22 times

imoham20
 
Posts: 4
Joined: Mon Apr 25, 2022 3:13 am

Tue Apr 26, 2022 9:00 am

Hi,

Thanks for your reply.
I reproduced your problem on my side and posted the problem to our bug tracking system with the problem number SPIREXLS-3821. I will let you know as soon as the problem is resolved or there is any update. Sorry for the inconvenience.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 388
Joined: Mon Mar 07, 2022 2:30 am

Return to Spire.XLS