Last post Dec 29, 2009 04:37 AM by BarbaMariolino
Dec 09, 2009 10:45 AM|Neems|LINK
Hey all Im new to asp.net, I am trying to create an application that would allow my users to export information to multiple EXISTING excel sheets. So far I have been sucessful in exporting to one sheet but I am unsure how to go about exporting it to multiple
excel sheets within the same workbook, does anyone have any ideas or can you point me in the right direction on how to do this! Any help is always much appreciated
Here is the code
Partial Class Export2Excel
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ExcelApplication As Excel.Application
ExcelApplication = CreateObject("Excel.Application")
Dim ExcelWorkBook As Excel.Workbook
ExcelWorkBook = ExcelApplication.Workbooks.Open("C:\ Files\10021 - 10037.xls")
Dim ExcelWorkSheet As Excel.Worksheet
ExcelWorkSheet = ExcelWorkBook.Worksheets(1)
ExcelWorkSheet.Cells(42, 1) = TextBox1.Text
Catch ex As Exception
Response.Write("Failure has occured")
Exporting data to excel
exportting data to excel in multiple tabs C#
Dec 09, 2009 11:38 AM|mudassarkhan|LINK
Dec 11, 2009 04:04 PM|chickflickssuck|LINK
Dim sheet1 As Excel.Worksheet = wb.Worksheets.Add()
As Excel.Worksheet = wb.Worksheets.Add()
from this point you may reference sheet1 and add objects. and sheet 2 seperately.
Dec 29, 2009 04:37 AM|BarbaMariolino|LINK
you really shouldn't use
Excel Interop on server side. Every time user clicks on your button you are creating new Excel instance and this can seriously degrade server and application performance.
Instead, try to find some library that doesn't rely on heavy guys that Excel app is.
I recommend GemBox.Spreadsheet -
.NET Excel component for
reading and writing XLS, XLSX, ODS, CSV and HTML files.
It is small, lightweight and fast component that uses it's own parsing engine so it is very well suited for server applications.
Here is an example how easy it is to
export/import DataTable to Excel and live web demo of
export to Excel in ASP.NET.