Jump to content

Determining # of Lines in "outputted" HTML / MS Word


Centinul

Recommended Posts

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.