Generating Page Breaks in Word from ASP

M

Mark

Hi - apologies in advance if this is not the correct forum - tried
searching loads, and still to find a workable solution.

Generating a word document from ASP - no problem. Inserting page breaks
into the generated page, so that when loaded into Word it forces a page
break, I cannot manage:

No matter if I use:

<p STYLE="page-break-after: always"></p>

or

<%=chr(10)%><%=chr(13)%>

...when opened in Word it will not start content on a new page.

Any ideas? Thank you,

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Response.Buffer = TRUE
Response.ContentType = "application/msword"
response.AddHeader "content-disposition", "inline; filename=xxx.doc"
%>
<%
'code to get a recordset here
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body style="font:verdana">
<p>&nbsp;</p>
' first generate table of contents
<% for i = 0 to numrows %>
<%=rsSolArr(0,i)%>: <a href="#<%=rsSolArr(0,i)%>"><%=rsSolArr(1,i)%></a>
<br>
<% next %>

'now generate actual content
<% for i = 0 to numrows %>
<p STYLE="page-break-after: always"></p>
<a name="<%=rsSolArr(0,i)%>"></a><%=rsSolArr(0,i)%>:
<%=rsSolArr(1,i)%><br>
<%=rsSolArr(2,i)%><br><br><%=chr(10)%><%=chr(13)%>
</div>
<% next %>
</body>
</html>
 
T

Tom Kaminski [MVP]

Mark said:
Hi - apologies in advance if this is not the correct forum - tried
searching loads, and still to find a workable solution.

Generating a word document from ASP - no problem. Inserting page breaks
into the generated page, so that when loaded into Word it forces a page
break, I cannot manage:

No matter if I use:

<p STYLE="page-break-after: always"></p>

or

<%=chr(10)%><%=chr(13)%>

..when opened in Word it will not start content on a new page.

Any ideas? Thank you,

How about the "reverse engineering" approach. Create a Word doc with a page
break, then save it as HTML and see what it gives you ...
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top