Solved

exporting page breaks to word docs

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl 101 11 72
Microsoft Edge 9 93
Swiper slider stops between pages 11 45
Grunt Copy file to another destination. 1 14
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
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 …
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…
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).

867 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

16 Experts available now in Live!

Get 1:1 Help Now