Page break in excel?

G

Guest

Hi,

I'm trying to perform a page break in excel with
Response.Write ("<tr height=17
style='page-break-before:always;height:12.75pt'><td></td></tr>");
in the following code, but with no success.

string strTableHeaders = "<tr><td>T1</td><td>T2</td><td>T3</td></tr>";
Response.Clear() ;
Response.ContentType = "application/vnd.ms-excel;charset=UTF-8";
Response.AddHeader ("Content-Disposition", "attachment;filename=Test.xls") ;
Response.Write ("<html>");
Response.Write ("<body style='FONT-size: 7.8pt; font-family: Helvetica'>");

Response.Write ("<TABLE border=0 cellPadding=1 cellSpacing=0 width='500'
style='FONT-size: 7.8pt; font-family: Arial'>");
Response.Write (strTableHeaders);
Response.Write ("<tr>");
Response.Write ("<td width='200' vAlign='top' align=left>ONE.1</TD>");
Response.Write ("<td width='150' vAlign='top' align=left>ONE.2</TD>");
Response.Write ("<td width='150' vAlign='top' align=left>ONE.3</TD>");
Response.Write ("</tr>");
Response.Write ("<tr style='page-break-before:always'><td></td></tr>");
Response.Write ("<td width='200' vAlign='top' align=left>TWO.1</TD>");
Response.Write ("<td width='150' vAlign='top' align=left>TWO.2</TD>");
Response.Write ("<td width='150' vAlign='top' align=left>TWO.3</TD>");
Response.Write ("</tr>");
Response.Write ("</table>");
Response.Flush();
Response.Write ("</body>");
Response.Write ("</html>");
Response.End() ;

Does anyone knows how to perform page-break in excel?

Thanks,
Ben
 
M

Martin Dechev

Hi, Ben

Try this knowlege base article:

"How To Format an Excel Workbook While Streaming MIME Content"
http://support.microsoft.com/?kbid=271572

You will have to use the Excel format xml - try to adjust some of the
examples in the "Microsoft Office HTML and XML Reference" (the link in the
begining of the article).

Hope this helps
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top