简体   繁体   中英

Create multiple tabs on excel via classic asp

I can export to page as excel file via this code below:

response.contenttype = "application/vnd.ms-Excel" response.Addheader "content-disposition", "attachment; filename=test.xls"

But I want to create multiple tabs on the same excel file, how I can do it?

Thanks for helps.

You cannot do that using the response.contenttype directive. that command only transforms a page into excel so you do not have the ability to create a new page as all of your html will be read as one page.

The solution depends on what your requirements are.

Free

The only free solution I know is building a page and pushing it to the browser as an XML file. If you create the file you want in excel and then save it in an XML format, you can open that file and see how the page should be build in asp.

Pros Its free. you do not need permission to install anything to the server. You will just be passing an xml file to the client.

Cons Excel is not the default viewer for xml files, notepad usually is. Most people will not understand how to open your file in excel. This means that this method is really only good for internal applications where you can change everyone's computer to open XML files in Excel by default.

3rd Party Program

When I needed to accomplish this same task I had entertained using 3rd party programs in classic asp. I wish I could remember the program but it would have cost around ~$1,000 to use.

Pros These programs are feature rich and will allow you to do anything you could want in exporting to excel. They are also cleaner and a bit simpler to use over writing your own XML file to open in excel.

Cons Costs money. may require server permissions you do not have. Most programs require you to save the file to the server before serving it to the client

ASP.NET

You can choose to instead create a new page in asp.net and use its excel features to create the file you need.

Pros Also free. Same extensive feature set available in most 3rd programs for classic asp are available with this method.

Cons classic asp and .net are not able to communicate directly so things like password protection on the page will become an issue if that is needed. You obviously need to know or learn the .net framework. Files are saved to the server before being sent to the client.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM