HTML2WORD - inserting page numbers

I am producing a word document from generated HTML using the CF tag WORD2HTML.

In developing I first create a WORD doc with word, the middle bit being where the generated data will go.

I then use WORD itself and save as html.

I then chop this html up into two parts - everything up to the data section (header.cfm) and the end which is everything AFTER the data (footer.cfm).

I keep these two files to wrap around the data which I generate as a file (data.cfm)

Then usin g CFFILE I join these 3 files together and use this html file to feed to the CF tag, WORD2HTML to output a WORD file.

So far, so  good. BUT, I want to include page numbers. Has anyone any idea as to how I can do this?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

go thru & u shld be able to get this done !

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kjuliffAuthor Commented:
That looks just what I need. I tried to implement but get the error below. I ckech on Macromedia's site and followed the instructions at
but sill I get this error

The error occurred in D:\htdocs\S+N\fred.cfm: line 80
Called from D:\htdocs\S+N\fred.cfm: line 80
Called from D:\htdocs\S+N\fred.cfm: line 80
78 :         <CFOBJECT
79 :             ACTION="create"
80 :             CLASS=" Word.Application"
81 :             NAME="objWord"
82 :             TYPE="com">

kjuliffAuthor Commented:
PS I left off the crusial part of the error message
The cause of this exception was that: An exception occurred when instantiating a Com object..
kjuliffAuthor Commented:
OK. I manage to connect to the com object. Burt now I get

The selected method Move was not found.  
There are no methods with the specified method name and argument types. Please check your function and try again.  

With the code from the source suggested above - see

<cftry>    <CFOBJECT



    // Open the doc
    objDocs = objWord.Documents;
    objDoc = objDocs.Open("d:\htdocs\s+n\fred.doc ");

// Get the 1st section's 1st footer's range object
    objSecs = objDoc.Sections;
    objSec1 = objSecs.Item(1);
    objSec1Footers = objSec1.Footers;
    objSec1Footer1 = objSec1Footers.Item(1);
    objRange = objSec1Footer1.Range;

    // Set the paragraph format
    // Values for alignment are {0=Left,1=Center,2=Right,3=Justify}
    objParaFormat = objRange.ParagraphFormat;
    objParaFormat.Alignment = 0;

    // Set a right-tab at 6 inches
    // Tab positions are in points, where 72 points = 1 inch
    // Arguments to the TabStops.Add function:
    //    Position: 6 inches * 72 points/inch = 432 points
    //    Alignment: values include {0=Left,1=Center,2=Right}
    objTabStops = objParaFormat.TabStops;

    // Insert the page number
    // Page number is field type 33
    // Story is unit type 6
    objFields = objRange.Fields;

    // Insert the footer's text
    objRange.InsertAfter("    Confidential and Proprietary");
    objSelection = objWord.Selection;
    objSelection.TypeText("Property of XYZ Corp.");

    // Exit

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.