Hello and thank you for reading this question.
I am exporting data from a database to an Excel spreadsheet via ADO in ASP using the following method:
<%response.ContentType="ap
plication/
vnd.ms-exc
el"%>
I simply iterate through my recordset placing the results in a table, and all works fine.
What I would like to be able to do, however, is to create a new sheet (or tab if you prefer) for each record, but I am not sure that it is possible to do so with ASP classic (although there is a solution with XML and ADO.net).
Does anybody have an idea how to do this in ASP classic?
If I do this, I can get two worksheets, but I still don't know how to place the content of each table on a separate worksheet:
<%@ Language=VBScript %>
<%Response.Buffer=true%>
<%
Response.ContentType = "application/vnd.ms-excel"
%>
<HTML xmlns:x="urn:schemas-micro
soft-com:o
ffice:exce
l">
<HEAD>
<style>
<!--table
@page
{mso-header-data:"&CMultip
lication Table\000ADate\: &D\000APage &P";
mso-page-orientation:lands
cape;}
br
{mso-data-placement:same-c
ell;}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>Sample Workbook</x:Name>
<x:WorksheetOptions>
<x:Print>
<x:ValidPrinterInfo/>
</x:Print>
</x:WorksheetOptions>
</x:ExcelWorksheet>
<x:ExcelWorksheet>
<x:Name>Sample Workbook 2</x:Name>
<x:WorksheetOptions>
<x:Print>
<x:ValidPrinterInfo/>
</x:Print>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
</x:ExcelWorkbook>
</xml><![endif]-->
</HEAD>
<BODY>
<TABLE>
<TR>
<TD>1</TD>
<TD>2</TD>
<TD>3</TD>
</TR>
<TR>
<TD>4</TD>
<TD>5</TD>
<TD>6</TD>
</TR>
<TR>
<TD>7</TD>
<TD>8</TD>
<TD>9</TD>
</TR>
</TABLE>
<TABLE>
<TR>
<TD>10</TD>
<TD>11</TD>
<TD>12</TD>
</TR>
<TR>
<TD>13</TD>
<TD>14</TD>
<TD>15</TD>
</TR>
<TR>
<TD>16</TD>
<TD>17</TD>
<TD>18</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Thank you,
Fritz the Blank
Start Free Trial