Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to convert excel file to Text format without installing ms office in c#.net version 4.0
Posted
Comments
ZurdoDev 22-Oct-13 14:59pm    
Perhaps if you explained more there may be a better way.

Well, it is not really a conversion. Basically you read the Excel file and write it to a text file for example.

See here for reading an Excel file[^]

and

here for writing a text file[^]

Of course you will have to extrapolate the pertinent material from each link and combine them to accomplish your goal.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 22-Oct-13 15:57pm    
My 5. And I credited this answer and added some detail/alternatives in my answer, please see.
—SA
Richard C Bishop 22-Oct-13 16:02pm    
Thank you, and a very thorough addition indeed.
Sergey Alexandrovich Kryukov 22-Oct-13 16:17pm    
Thank you.
—SA
First of all, as it is correctly stated in Solution 1, this is not really a conversion. There is no one-to-one correspondence between Excel and text data, so you need to define some mapping between the two. And you should expect that saving data as text in most cases will cause some loss of information and increase of information entropy. Please see:
http://en.wikipedia.org/wiki/Map_%28mathematics%29[^],
http://en.wikipedia.org/wiki/Data_mapping[^],
http://en.wikipedia.org/wiki/Entropy_%28information_theory%29[^].

If you need to read Excel without installation of Office (quite understandable), the main method of doing so would be using Open XML SDK:

http://www.microsoft.com/en-us/download/details.aspx?id=30425[^].

This way, you can support new XML-based Office formats (such as .DOCX, .XLSX), ECMA-376 standard:
http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats[^],
http://en.wikipedia.org/wiki/Office_Open_XML[^].

This way, you can work without Office installed. Also, the documents are supported by 3rd-party software. Please see my past answers:
Convert Office-Documents to PDF without interop[^],
Need a rather unique WPF text editor control[^],
Hi how can i display word file in windows application using c#.net[^],
Read a word file without using Interop.word dll...Do not want to install word in IIS..[^].

This is another option: http://npoi.codeplex.com/[^].

Microsoft explained why using Office interop would be unsuitable in some settings:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2[^],
http://support.microsoft.com/kb/257757/en-us[^].

—SA
 
Share this answer
 
Reference Excel Objects Library , a COM library in your project. Then Read the excel file and write to text file one line at a time.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900