Solved

exporting page breaks to word docs

Posted on 2004-08-06
6
215 Views
Last Modified: 2010-04-06
i'm trying to export records from a mysql db using php.  i can export them into word fine, but i'd like a page break between each record.
i've tried using css page-break-after: always, which works when printing from a web page, but not when it's exported to a word doc.
is this possible?
i'm on a linux server with apache, mysql ,and php.
0
Comment
Question by:DarthScott26
  • 2
6 Comments
 

Expert Comment

by:stonefeet
ID: 11739797
Best solution I know of is replacing your <br> tags with the new-line character ('\n') omitting the quote-marks, of course. (:
0
 

Author Comment

by:DarthScott26
ID: 11752206
i want a page break, not a line break.  i don't have any <br> tags.  basically there's a part of my website where users can type messages to loved ones and then a site administrator will print them out and mail them.  these letters can be multiple pages, but at the end of each letter, it needs to have a page break and start the next letter on the next page.
i need it to print with letterhead which is why i'm trying to get it to print from word rather than just printing from the browser with page-break-after:always statements.

0
 
LVL 2

Accepted Solution

by:
kmcorbett2 earned 250 total points
ID: 11807144
The control character for "form feed" is ^L (control-L) or code 12. Form feed is sometimes denoted by the control sequence '\f' in program string literals.

Try emitting ^L directly in your HTML output. I don't think you can use a character entity or control sequence.

You don't provide any details on how you are exporting to Word format. If  you were generating RTF, you would probably be using the corresponding formatting sequences. So I'm assuming you are generating HTML and relying on Word's import functionality.

In my testing, opening an HTML file directly in Word, it behaves somewhat inconsistently with regard to converting formatting control characters. Literal control characters for tab, newline, and form feed all "work", and "&#014" generates a newline, but "&#09" and "&#012" have no effect.

/kmc
0
 
LVL 2

Expert Comment

by:kmcorbett2
ID: 11849199
DarthScott26: have you had a chance to try my suggestion? (^L or ASCII code 12)

/kmc
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
The viewer will learn how to count occurrences of each item in an array.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question