Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# XML Excel
Hi All,
 
I want to create a basic application that browses a excel document and converts its contents into a xml format, any help would be helpful.
 
Thanks,
Kiran
Posted 19-Feb-13 8:54am
Comments
Maciej Los at 19-Feb-13 15:00pm
   
Please, provide more details. Did you know that Excel 2007 - 2010 files are based on xml files? See this: http://en.wikipedia.org/wiki/Microsoft_Excel
Sergey Alexandrovich Kryukov at 19-Feb-13 15:17pm
   
From my answer, it should be clear that the format is already XML, zipped — please see.
—SA
Maciej Los at 19-Feb-13 15:25pm
   
I knew it, Sergey. I was first with my comment, than you with your answer ;)
Sergey Alexandrovich Kryukov at 19-Feb-13 15:34pm
   
But you did not answer on the file formats. :-)
—SA
Maciej Los at 19-Feb-13 15:40pm
   
Yes, that's because i'm not sure what OP wants to ask.
Sergey Alexandrovich Kryukov at 19-Feb-13 15:49pm
   
Well, I'm not even sure OP understands what she/he wants...
—SA
Maciej Los at 19-Feb-13 16:34pm
   
Agree ;)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

There is no such thing as just "XML format". XML is a kind of a media for many formats. This way, the question does not have a full sense. I just want to bring to your attention that an .XLSX Excel document is already XML; you only need to unpack the file, which is actually is a ZIP format. You can learn about the format here:
http://en.wikipedia.org/wiki/Office_Open_XML_file_formats[^],
http://en.wikipedia.org/wiki/Office_Open_XML[^].
 
What you are going to do with that is your business. From your question, I'm not sure you really know what.
 
[EDIT]
 
For working with ZIP, you can use #ziplib:
http://www.icsharpcode.net/opensource/sharpziplib/[^].
 
Another option is using SevenZipSharp, a .NET wrapper of the famous 7-Zip:
http://en.wikipedia.org/wiki/7-Zip[^],
http://sevenzipsharp.codeplex.com/[^].
 
Both ZIP libraries are open-source.
 
Good luck,
—SA
  Permalink  
v2
Comments
Maciej Los at 19-Feb-13 16:34pm
   
What about Excel 1997-2003, XP file formats?
Sergey Alexandrovich Kryukov at 19-Feb-13 16:58pm
   
If anyone needs that, it's solvable. The source code of LibreOffice and OpenOffice is available; they can use those files. The code can be written in C# or wrapped using P/Invoke or C++/CLI. That's the solution.
—SA
Maciej Los at 19-Feb-13 17:01pm
   
The answer is complete now ;)
+5!
Sergey Alexandrovich Kryukov at 19-Feb-13 17:07pm
   
Thank you very much, Maciej.
Another very funny answer is almost ready, take a look...
—SA
Sergey Alexandrovich Kryukov at 19-Feb-13 17:17pm
   
And to make it more complete, I added the advice on how to work with ZIP (mostly because another question was about JAR, which is also ZIP :-).
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

See whether his article can help
Generate Excel from XML and Generate XML from Excel[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 505
1 OriginalGriff 258
2 ChintanShukla 195
3 Bhavik_Patel 170
4 Richard Deeming 165
0 Sergey Alexandrovich Kryukov 8,688
1 OriginalGriff 7,237
2 CPallini 2,598
3 Richard MacCutchan 2,080
4 Abhinav S 1,888


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 19 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100