Page break in excel?

Discussion in 'ASP .Net' started by =?Utf-8?B?QmVu?=, Sep 22, 2004.

  1. 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
    =?Utf-8?B?QmVu?=, Sep 22, 2004
    #1
    1. Advertising

  2. 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
    "Ben" <> wrote in message
    news:...
    > 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
    >
    >
    >
    Martin Dechev, Sep 22, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Mueller

    How to add a page break to a HTML page

    Stefan Mueller, Mar 9, 2006, in forum: HTML
    Replies:
    2
    Views:
    163,388
    Stefan Mueller
    Mar 10, 2006
  2. stephpom
    Replies:
    3
    Views:
    637
    stephpom
    Aug 30, 2007
  3. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Replies:
    15
    Views:
    1,499
    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=
    Oct 24, 2007
  4. Replies:
    12
    Views:
    958
  5. Q. John Chen

    Render to Excel - line break problem.

    Q. John Chen, Aug 28, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    350
    Q. John Chen
    Oct 2, 2006
Loading...

Share This Page