views:

372

answers:

1

I have a classic ASP web app that outputs reports to Excel, but it's really just html.

Some reports output with multiple groups and each group can span multiple pages (vertically). I'm aware of the "Page Titles" ability of Excel to print a specified row (or rows) on every page, however, I need the title of each group to also display in the title. Otherwise the title of the first group gets displayed as the title of every group.

I saw on google groups that someone suggested putting each group on a separate worksheet however I don't think I can output multiple worksheets easily - or at all - using html alone.

I'm looking for a quick and dirty solution as I don't have much time to devote to maintaining this crufty old app.

A: 

This is a bit late as answers go but I think I have found a solution. What you can do is open Excel, manually mock up what you want, then save it as a webpage. Open the generated file(s) up in a simple text editor and examine the generated HTML/XML. I did this for a workbook with multiple worksheets and it appears to work.

You can do the same with the multiple groups since that seems like the solution you really want, the process is the same. But the multiple worksheets option will work as well. Here are the interesting bits of what Excel generated for me (from Book.htm, not the Sheet files) when I saved a simple 2 sheet workbook with 'abc' on the first page and 'def' on the second:

<script language="JavaScript">
 var c_lTabs=2;

 var c_rgszSh=new Array(c_lTabs);
 c_rgszSh[0] = "Sheet1";
 c_rgszSh[1] = "Sheet2";

------

<xml>
 <x:ExcelWorkbook>
  <x:ExcelWorksheets>
   <x:ExcelWorksheet>
    <x:Name>Sheet1</x:Name>
    <x:WorksheetSource HRef="Book1_files/sheet001.htm"/>
   </x:ExcelWorksheet>
   <x:ExcelWorksheet>
    <x:Name>Sheet2</x:Name>
    <x:WorksheetSource HRef="Book1_files/sheet002.htm"/>
   </x:ExcelWorksheet>
  </x:ExcelWorksheets>
  <x:Stylesheet HRef="Book1_files/stylesheet.css"/>
  <x:WindowHeight>13065</x:WindowHeight>
  <x:WindowWidth>15315</x:WindowWidth>
  <x:WindowTopX>360</x:WindowTopX>
  <x:WindowTopY>75</x:WindowTopY>
  <x:ProtectStructure>False</x:ProtectStructure>
  <x:ProtectWindows>False</x:ProtectWindows>
 </x:ExcelWorkbook>
</xml><![endif]-->
</head>
colithium