Link to home
Start Free TrialLog in
Avatar of Victor  Charles
Victor CharlesFlag for United States of America

asked on

Help with saving xml file as an excel using VB.NET

Hello,

 Is there a way to save an xml file as an excel file (.xls/.xlsx)?

Thanks,

 Victor
Avatar of mankowitz
mankowitz
Flag of United States of America image

Are you sure you want to do this?

The XLSX format is very complicated. See here

If you are just saving a table of values, you probably want to just save as a CSV file, which excel natively opens.

If you want to use interop (and you already have excel loaded on the target machines), you'd do somwthing like this

Dim ws As New Microsoft.Office.Interop.Excel.Worksheet
ws.SaveAs("c:\" & whatever)
Avatar of Victor  Charles

ASKER

Hi,

Looking at your code, where  do you include the xml file?

Thanks.
what format is your data in right now?
It's  in xml.
What I meant is what kind of data is it? For example, you can easily export a 2d array of strings and numbers as CSV. If there are charts and graphs, you will have to massage it into the xlsx format.
Included  in the xml are plain text and numbers, no charts and graphs are included.
Can you open the file in excel directly? I mean, Open | Import XML..
Hi,
.
I'm creating the xml file from the application by running a Query and filtering a table, would than like to save the data (results) in excel format.
ASKER CERTIFIED SOLUTION
Avatar of mankowitz
mankowitz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you.