Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 28th, 2004, 05:21 AM
Authorized User
 
Join Date: Jan 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default Generate Excel spreadsheet with ASP.Net (VB)

Hi there,

I understand there are commercial ASP.Net tools available that enable you to generate an Excel spreadsheet on the server (from a set of data) and send it to the user's browser (for opening there).

I have looked at a couple of these.

Please can someone recommend one to me? The best one... or a good one...

Many thanks.

James
 
Old July 28th, 2004, 07:47 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You don't need anything commercial. You can generate Excel with raw HTML. All you need to do is generate an HTML <table> with your data and formatting within it. You also need to specify the content type of the response so the browser knows that it's looking at "Excel content". There are numerous example on this forum that explain how to do this. Try searching on here for "excel" and "ContentType". That should get you pretty close to what you need.
 
Old December 11th, 2013, 08:15 AM
Registered User
 
Join Date: Dec 2013
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Generate Excel spreadsheet with ASP.Net (VB)

Hi, to create an Excel file in .NET you can check out a free version of this VB.NET Excel component.
Here is a small demonstration how to export an Excel file in ASP.NET:
Code:
' Extract DataTable from current ASP.NET session.
Dim dataTable = DirectCast(Me.Session("people"), DataTable)

' Create Excel file.
Dim workbook = New ExcelFile()
Dim worksheet = workbook.Worksheets.Add("DataSheet")

' Insert DataTable to worksheet.
worksheet.InsertDataTable(dataTable,
    New InsertDataTableOptions("A1") With {.ColumnHeaders = True})

' Stream file to browser in XLS file format.
workbook.Save(Me.Response, "Sample.xls")





Similar Threads
Thread Thread Starter Forum Replies Last Post
connecting to excel spreadsheet using asp codetoad Classic ASP Databases 1 March 21st, 2007 04:02 AM
Launch the .Net Win Forms from Excel spreadsheet Arunikhanna81 C# 0 January 15th, 2007 10:54 PM
Embedding an Excel spreadsheet in a VB application James Diamond Pro VB.NET 2002/2003 3 April 21st, 2004 11:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.