export dynamic html table to excel - c#

i am generating dynamic html table using web browser control . And now, im having problem to export it to excel. As im searching it thru internet, mostly said use syntax"Response.write" or "htmlcontext.current" but i cannot use those syntax due to I'm using Windows Form.
is there any other way to export it to excel? I really need help on this. Thanks!

There are several tools available to generate Excel documents from .Net, for example:
SpreadSheetLight
NPOI
EPPlus
ClosedXML

Related

How to generate excel like report in WPF?

I have this Excel Sheet That I want to generate from my WPF Application, What is the easiest way to do so, bear in mind that the table in the sheet may have many containers and each container may have one or more sizes and so on as shown.
I'v looked at the ReportViewer provided in WPF but I don't know how to design such a report using the ReportViewer.
Another thing came to my mind is to fill the excel sheet from the WPF and I found a way to do so by specifying tags (Ex: Date: ) in which I can fill these tags from my WPF application, but I don't know who to generate tables and set their columns and rows according to the data in the database.
Thank you.
Did you try adding Microsoft.Office.Interop.Excel as a dll, and try the code given here.
Or have a look at this sample:
WPF Spreadsheet
I have made good experience with the EPPlus library. The nice thing is, you don't need any MS Office components on your OS to generate the excel files.

Auto formatting of excel cells upon exporting

A sort of a newbie here! I just want to know is there a way to auto format the cells in excel, upon exporting it? I am using c#.net and I can't find any codes for what I am looking for. Thanks!
If you are attempting to create the excel file from scratch or edit it's xml source directly, consider using the OpenXml SDK here: http://www.microsoft.com/en-us/download/details.aspx?id=5124
If you would like an easier approach use the classes/methods provided in the Microsoft.Office.Interop.Excel namespace. Performance here is much worse and you will be required to have Office installed, but the learning curve is not nearly as steep as for OpenXml
Another option would be using EEPlus, it has everything you need including auto formatting cells and it's incredibly fast with no need to open Excel.
You can find more info here: EPPlus

asp.net: Read data from uploaded Excel document

I would like to know the best way to read data from an uploaded excel document. Im currently using http://exceldatareader.codeplex.com/, which works good. The problem is that it cant read the values from checkboxes or radiobuttons. Im using asp.net framework 3.5. Any help is appreciated. Thanks
IF you have Excel installed on your system, you could include Microsoft.Office.Interop.Excel assembly and use that to do everything you need.

export to excel from sharepoint - complex

There is some code/werbparts on our site that display a lot of data in a grid on our site. In addition, they have another page with a few charts.
I need a way to create functionality to export this to excel so the user can click a button and save everything.
The chart will actually have to be built in excel, I can't just grab the picture from the website and display it.
Also, the data from the grid will have to be put into a spreadhseet. I am not as worried about this part.
I have exported to excel before, but it was just basically printing some data which was tab delimited with a certain doc type .
This actually will need to use different work sheets and use some excel functionality.
(I need a better answer than use excel services)
Thanks!
Use Epplus is a third party library for creating and manipulating excel files(xlsx)
Dunno about sharepoint, but the OpenXML SDK might be what you're after:-
http://msdn.microsoft.com/en-us/library/bb448854.aspx

C# Best way to read a XLS (XLSX) file and populate a datagrid

What is the best (free or paid for) to read Excel files (XLS and XLSX) using C# and populate a datagrid, I would also like to have any changes made in the datagrid be written back to the file.
I should also add that it needs to be high performing as the datagrid can contain a significant number of rows (10,000+).
This would be used for a commercial application so it would need to be distributable.
This is a Windows Forms application.
I recommend databinding the datagrid to a dataset/datatable populated via the ADO.NET OleDb provider.
You'll find an example at Read from Excel using OleDb in a Windows Service?
I also found How To Use ADO with Excel Data from Visual Basic or VBA and How To Use ADOX with Excel Data from Visual Basic or VBA to be useful in knowing how to create a table (sheet) and access sheets and ranges.
It works very well for xls files. I haven't tried using it for xlsx.
SmartXLS for .Net
It support read/write xls/xlsx files and can import/export workbook datas to/from a datagrid.
You don't define whether you speak about web or fat client application.
You can use Open XML SDK 2.0 for Microsoft Office for reading XLSX file. (see http://www.microsoft.com/downloads/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0&displaylang=en and http://msdn.microsoft.com/en-us/library/cc850837(v=office.14).aspx for some examples and also on http://openxmldeveloper.org/default.aspx.)
You can display and allow to modify the content in a grid like jqGrid (see http://www.trirand.com/blog/?page_id=6) if you use a Web application. This grid is the best jQuery plugin which has a lot of different features and allow implement practical every scenario.
After all you can use Open XML SDK to save result in a modified XLSX file.
For xlsx :
http://msdn.microsoft.com/en-us/library/bb332058%28v=office.12%29.aspx
http://www.codeproject.com/KB/office/OpenXML.aspx

Categories

Resources