Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET VB.NET
Hello every1
 
i have an excel file and i want to export it to html as per our client requirement. how can i do it without using office interop.
 

thank you in advance.
Posted 20-Dec-12 7:00am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

There are .net libabries (even free) out there (google will help) that can read xls and/or xlsx.
For example this one: http://exceldatareader.codeplex.com/[^], that can read borth, but no formatting as I see.
 
Choosing the right one depends on how exactly this export should be performed (only content matters, or you need to follow exact styling), and what exactly this excel file contains (only data and formulas, or are there any external references, or are there even embedded objects).
 
I think if you have embedded objects, you will not be able not avoid using Excel or some other excel-compatible spreadsheet editor interop - or you will have to code a lot.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

See below code, it maybe the most simplest code that I have ever seen:
  			'load Excel file
			Dim workbook As New Workbook()
			workbook.LoadFromFile("..\..\test.xls")
 
			'convert Excel to HTML
			Dim sheet As Worksheet = workbook.Worksheets(0)
			sheet.SaveToHtml("sample.html")
 
			'Preview HTML
			System.Diagnostics.Process.Start("sample.html")
 
See details in Convert Excel to HTML[^]
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

If you have not installed excel on your system, you may try some .NET component that can do this task without Microsoft Office Automation. Such as Spire.Xls or Aspose.Cells.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Convert the file to csv, the split it on commas into an string array.
 
Add the elements from your array to your html file.
  Permalink  
Comments
Adam R Harris at 20-Dec-12 13:28pm
   
He wants to do it without the interops i.e. Excel not installed on the server.
If he can get the files as a csv instead of .xsl then your solution would work.
Jagdish.rkl at 20-Dec-12 13:34pm
   
Thanks Dino and Thanks Adam.
can any one of you just provide a sample code for me. i am new to asp.net. i dont know how to do this.
 
Thanks in advance
DinoRondelly at 20-Dec-12 14:59pm
   
Code sample for?
I am not sure how your going to deal with the file if you dont have excel sorry, your going to have to research that a little more then i can right now.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Thanks to all of you for your prompt response to me. i am unable to solve it yet. what i have decided is to read the data from the excel through oledb and convert it into xml. later on make that xml display as html. i have got success in converting excel to xml but no success with xml to html.
 
Thank you all
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 303
1 Sergey Alexandrovich Kryukov 291
2 RyanDev 75
3 nv3 60
4 PhilLenoir 50
0 Sergey Alexandrovich Kryukov 6,691
1 OriginalGriff 6,119
2 CPallini 2,473
3 Richard MacCutchan 1,697
4 Abhinav S 1,560


Advertise | Privacy | Mobile
Web01 | 2.8.140821.2 | Last Updated 21 Dec 2012
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