Solved

exporting page breaks to word docs

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
XSL Grouping 7 36
Make a query passing words with accent 16 82
PHP email variable syntax 3 44
Problem to file 3 49
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 …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

760 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now