473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Any way to create two sheets in same excel file?

TJ
Hi,

Basically, I want to create excel file on the fly, then force users to
download it
without using automation.

Here is one of ways..

System.IO.StringWriter sw = new System.IO.StringWriter();
......
Response.Clear();
....
...
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
Response.AddHeader("Content-Disposition","attachment; filename=test.xls" );
Response.ContentEncoding = System.Text.Encoding.Default;
.....
.....
sw.WriteLine(...
//Write header

........

....
sw.WrihteLine(...
//Write content

.....
sw.Flush();
Response.End();

It works great, but one issue came up I need to solve...
I want to create ONE excel file that contains SEVERAL WORKBOOT SHEETS such
as Sheet1, Sheet2 and Sheet3....I think I can do this with automation, but
can't think of how it can be done without COM automation.

If using above code, it only creates one workbook sheet......
Again,

How do I create ONE excel file that contains SEVERAL SHEETS WITHOUT using
automation?

Thanks.

.................................................. ................................TJ
Nov 19 '05 #1
2 1639
For this kind of advanced exporting capability I'd suggest one of these
products to help you out:
http://SteveOrr.net/Reviews/AsposeExcel.aspx
http://officewriter.softartisans.com...ewriter-8.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"TJ" <TJ@discussions.microsoft.com> wrote in message
news:E7**********************************@microsof t.com...
Hi,

Basically, I want to create excel file on the fly, then force users to
download it
without using automation.

Here is one of ways..

System.IO.StringWriter sw = new System.IO.StringWriter();
.....
Response.Clear();
...
..
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
Response.AddHeader("Content-Disposition","attachment;
filename=test.xls" );
Response.ContentEncoding = System.Text.Encoding.Default;
....
....
sw.WriteLine(...
//Write header

.......

...
sw.WrihteLine(...
//Write content

....
sw.Flush();
Response.End();

It works great, but one issue came up I need to solve...
I want to create ONE excel file that contains SEVERAL WORKBOOT SHEETS such
as Sheet1, Sheet2 and Sheet3....I think I can do this with automation, but
can't think of how it can be done without COM automation.

If using above code, it only creates one workbook sheet......
Again,

How do I create ONE excel file that contains SEVERAL SHEETS WITHOUT using
automation?

Thanks.

.................................................. ..............................TJ

Nov 19 '05 #2
Use ADO(.NET) and threat it as a database.
See www.connectionstrings.com for the Extended properties.
You can build excel files with sql.
There is this first-row/HDR issue though(!)

"TJ" <TJ@discussions.microsoft.com> schreef in bericht
news:E7**********************************@microsof t.com...
Hi,

Basically, I want to create excel file on the fly, then force users to
download it
without using automation.

Here is one of ways..

System.IO.StringWriter sw = new System.IO.StringWriter();
.....
Response.Clear();
...
..
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
Response.AddHeader("Content-Disposition","attachment;
filename=test.xls" );
Response.ContentEncoding = System.Text.Encoding.Default;
....
....
sw.WriteLine(...
//Write header

.......

...
sw.WrihteLine(...
//Write content

....
sw.Flush();
Response.End();

It works great, but one issue came up I need to solve...
I want to create ONE excel file that contains SEVERAL WORKBOOT SHEETS such
as Sheet1, Sheet2 and Sheet3....I think I can do this with automation, but
can't think of how it can be done without COM automation.

If using above code, it only creates one workbook sheet......
Again,

How do I create ONE excel file that contains SEVERAL SHEETS WITHOUT using
automation?

Thanks.

.................................................. ...............................TJ

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ilan | last post by:
Hi all I need to add data from two Excel sheets (both on the same workbook) to an existing table in my SQL DB. The problem is that each sheet holds different fields for the same record, though...
0
by: I Decker | last post by:
Hi all, Hope this is the right group. I am writing a program in c# to open create an excel document, enter some data, save it and then email it as an attachment. I have successfully created...
1
by: sk | last post by:
Please forgive me if the same topic is already posted. But i havent found I have got an error while accessing the excel file as below. Can somebody reply if there is a solution Access is denied....
4
by: Hitesh | last post by:
Hi, I have three datagrid control on my aspx page and one export to excel button, i want to export all the 3 datagrids contents in one excel file. how can i achive that? -- Thanks Hitesh
7
by: KC | last post by:
Does anybody know how to add a specific number of worksheets to an Excel spreadsheet through VB.net? I'm trying to export some datatables to an excel file, but I only want as many sheets in the...
4
by: Abdhul Saleem | last post by:
Hi, I am recieving error ActiveX component can't create object in the following line in the asp page. set ExcelApp = CreateObject("Excel.Application") Previously this code was working fine....
0
by: Steve1974 | last post by:
Hi All I am currently using Access to output to excel. The creation of the worksheet goes ok, and then I have a piece of code (recorded from an Excel macro) to create pick lists for two columns...
1
by: dwmaillist | last post by:
Hello, I am interested in extracting the information from an excel workbook with many sheets in it and outputting a csv like text file. Since I want a single file with all information for all...
11
by: =?Utf-8?B?UGV0ZXIgSw==?= | last post by:
I am working with Visual Studio or alternately with Expression Web. I need to create about 50 aspx pages with about 1200 thumbnali images, typically arranged in three to four groups per page,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.