WPCubed Product Support

Insert an calculates page number

How can I insert a calculated page number that will be for example the document page number + 12?

I need this to print a book that has a serie of documents that will be some reports (Report Builder) and some from WPTools, but I have to put the correct page number; each page number will be the last document printed page number + the actual document page number.

Is it possible to put this valiable on the document without opening it? How can I do it?

Thanks

David Gurevitz

#1 ♥ 0
7.4k Views 2 users read 5 min
support

Hi,

there are various possibilites:

event:
OnCalcPageNr

OnTextObjectGetTextEx

and the properties

WPRichText.Memo.OverridePageCount

and

WPRichText.Memo.OverridePageOffset

which should do what you need.

Julian

#2 ♥ 0

Thanks Julian.

I could fix one problem.

I still have 4 more:
1.How can I override de total number of pages of a document, adding for example 12 to the total?

  1. How can I get the number of pages of a document? I'll need that to pass to the next report / document of the book.
  2. How can I insert those variables without opening the document?
  3. How can I print the document withou open it?

Regards

David Gurevitz

#3 ♥ 0
support

Hello David ,

1.How can I override de total number of pages of a document, adding for example 12 to the total?

Doesn't OverridePageCount does this for You ?

  1. How can I get the number of pages of a document? I'll need that to pass to the next report / document of the book.

WP.PageCount

  1. How can I insert those variables without opening the document?

That's not possible.

  1. How can I print the document withou open it?

This sounds funny. No, of course a document must be loaded to print it.

Unless You convert Your document to PDF first. Theny You could work with a file format which uses fixed page breaks.

You could create a combined PDF document from multiple texts in WPTools plus inserted reports and add page numbers later. Required would be wPDF to create the PDF and for printing then the WPViewPDF.

If this sounds interesting I could develop further, for example to use variables in PDF such as @#1@ and @##@ which it updates "on the fly" with the current page count.

The benefit would be to have a preview for the complete document, even if it has 5000 pages.

Regards,
Julian Ziersch

#4 ♥ 0

Hi Julian,

Thanks for the reply!

"Doesn't OverridePageCount does this for You ?"
Yes, its working.

In one aplication what I have now are just PDF's documents, created printing from inside Word.

I should put the page numbers on it, from inside my program, when I print a book that is composed by reports (with unknown number of pages) and fixed documents, that I'll transform from doc to rtf to use your aplication inside my program.

In other aplication, I'll nedd to do the same but I'll have to edit the rtf texts and then put the page numbers, too.

You see, the best for my users should be call the print book button and the system then open the reports and rtf's in a hide mode (is it possible?),then put the page numbers and print each one automactly.

For my first aplication it's easy to do it with PDF, as I have fixed reports and I've tryed a tool that stamp the page numbers withou opening the pdf (PDF Toolkit); but this doesn't solve my second aplication that needs a text editor. Of course I'd like to have one solution for both cases, and your toll is much more powerfull then just PDF Toolkit.

#5 ♥ 0
support

Hi,

Sorry, cannot comment on the tool kit. We have a powerful solution to print and merge PDF files - WPViewPDF.

A solution is only thinkable if wPDF and WPViewPDF is used together since then they can exchange special data about page number and count.

Julian

#6 ♥ 0

Dear Julian

My last questions are:

  1. Is it possible to open the document in a hide mode using wptools? If so, how can I do?
  2. Heather: When I put the page number, I need also to put another 2 variables (name of my client and the local of his work); the name of my client will be at the same line of the page number, bt at the center of the line (page number will be on right); the local of the client will be in other line after the first one, center, too. How can I insert them on the correct position

Tks,

#7 ♥ 0
support

Hello,

  1. Is it possible to open the document in a hide mode using wptools? If so, how can I do?

Yes, You can create a hidden TWPCustomRTFEdit instance. Call CreateDynamic.

The load the file and call RefcormatAll.

After that you can use the property PageCount.

When I put the page number, I need also to put another 2 variables (name of my client and the local of his work); the name of my client will be at the same line of the page number, bt at the center of the line (page number will be on right); the local of the client will be in other line after the first one, center, too. How can I insert them on the correct position

You can use merge fileds or text objects (InputTextFieldName).

To position them use tab stops.

Julian

#8 ♥ 0

Dear Julian,

Working fine in background and hidden.

On the heather: Can you pls show me one example on the use of the merge fields or text objects (InputTextFieldName) and how to position them use tab stops.

It's my last question for now!

Tks

#9 ♥ 0
support

Hi,

please check out the docu about header and footer.

Some code:

Paragraph := WPRichText1.HeaderFooter.Get(wpHeader, wpraOnAllPages).FirstPar;
obj := Paragraph.AppendNewObjectPair(wpobjMergeField, 'Display Text', 0);
obj.Name := 'Field_Name';

You can use various methods of TParagraph, see Insert and TabstopAdd

Julian

#10 ♥ 0
This category is archived. No new posts are possible.