Solved

exporting page breaks to word docs

Posted on 2004-08-06
6
213 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

777 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