page break

General TRichView support forum. Please post your questions here
Post Reply
adamrich
Posts: 35
Joined: Sun Feb 19, 2006 1:55 pm

page break

Post by adamrich » Sun Oct 27, 2019 3:19 pm

Hello,

On create new document I like to do this : (if possible)
1-Set page size 8.5 x11 inch.
2-Add page break or line on inch 10 (leave one inch on the bottom for my footer). or disable any entry after inch 10, something like that

Thank you

Sergey Tkachenko
Site Admin
Posts: 14708
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: page break

Post by Sergey Tkachenko » Sun Oct 27, 2019 8:18 pm

Do you use TSRichViewEdit (ScaleRichView) or TRichView/TRichViewEdit?

adamrich
Posts: 35
Joined: Sun Feb 19, 2006 1:55 pm

Re: page break

Post by adamrich » Mon Oct 28, 2019 4:47 pm

Hello,

I use TRichViewEdit

Thank you

Sergey Tkachenko
Site Admin
Posts: 14708
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: page break

Post by Sergey Tkachenko » Mon Oct 28, 2019 5:37 pm

TRichViewEdit itself does not have a page size, it represents a single bottomless page.
A page size appears when printing or when exporting to RTF/DocX.

For printing, TRichViewEdit uses the current printer settings.
So, if you want to print on 8.5 x 11 inch ("letter" format), you need to assign this format on the current printer.
The example is here: https://www.trichview.com/forums/viewto ... tPaperSize
Call SetPaperSize(DMPAPER_LETTER).

For export to RTF/DocX, assign the proper size to RichViewEdit.DocParameters.PageWidth and PageHeight, and include rvrtfSaveDocParameters in RichViewEdit.RTFOptions.

Now, you need to reserve space for footer.
You can set the bottom margin = 1 inch. And you can define the bottom coordinate of the footer.
For printing, it is RVPrint.Margins.Bottom and RVPrint.FooterY.
For export to RTF/DocX, it is RichViewEdit.BottomMargin and FooterY.
See the schemes in https://www.trichview.com/help/idh_class_trvprint.html

adamrich
Posts: 35
Joined: Sun Feb 19, 2006 1:55 pm

Re: page break

Post by adamrich » Tue Oct 29, 2019 1:43 pm

Thank you,

I did all that, but unfortunately, I'm unable to stop the user from typing even after 11 inch paper length.
all I need to force the user from exceeding the paper size, if exceeded the user will need to create new document,
I'm able to stop the user on the width by adding MaxTextWidth.

Thank you again for your time

Sergey Tkachenko
Site Admin
Posts: 14708
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: page break

Post by Sergey Tkachenko » Tue Oct 29, 2019 1:54 pm

The only solution that I can imagine is reformatting TRVPrint when the user edits the document (call RVPrint1.FormatPages in RichViewEdit1.OnChange), and if RVPrint1.PagesCount > 1, call RichViewEdit1.Undo.

Post Reply