Centinul Posted July 16, 2007 Share Posted July 16, 2007 Preface: Currently I'm using PHP to modify an HTML document and once that is finished I pass a header to the user as a Microsoft Word document. Ultimately the user will be using MS Word to view / edit the document. Requirement: On every page > 1 I need to insert the subject line of the letter as the first line on the 2,3,4.... pages. Problem: I don't know how to determine the # of Lines Word would detect the document as. If I knew that I could determine how many pages the document is based on the formatting settings (46 lines per page at the moment). Unfortunately I cannot figure out a way to solve this problem. In short I need to determine how many pages the resulting word document would be so I can insert text at the top of every page > 1. Any thoughts? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/60200-determining-of-lines-in-outputted-html-ms-word/ Share on other sites More sharing options...
MadTechie Posted July 16, 2007 Share Posted July 16, 2007 so you need to work out the paper size, if word wrap is on and the font size and the line spacing etc etc also i assume you are using M$ words ability to convert the HTML to a doc.. Quote Link to comment https://forums.phpfreaks.com/topic/60200-determining-of-lines-in-outputted-html-ms-word/#findComment-299489 Share on other sites More sharing options...
Centinul Posted July 16, 2007 Author Share Posted July 16, 2007 Paper Size: 8.5x11 Left, Right, Bottom Margins: 1" Top Margin: 1.4" Font: Courier New, 12 point. MS Word wraps the text. To be clear, I take an HTML Template and pass it as a MS Word file in the header. The user then opens it up in Word. I need to figure out a way to determine how many pages and then a way of inserting text on the top line of every page after page one. What next? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/60200-determining-of-lines-in-outputted-html-ms-word/#findComment-299497 Share on other sites More sharing options...
Wildbug Posted July 16, 2007 Share Posted July 16, 2007 Are you running PHP on Windows? If so, perhaps this package would be of use to you. I've never used it myself, but it looks like you can create a Word document on-the-fly. And if you can do that, you may be able to use MS Word's header/footer functionality to generate page numbers without trying to guess where they should go. Quote Link to comment https://forums.phpfreaks.com/topic/60200-determining-of-lines-in-outputted-html-ms-word/#findComment-299635 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.