Page 1 of 1
page break
Posted: Sun Oct 27, 2019 3:19 pm
by adamrich
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
Re: page break
Posted: Sun Oct 27, 2019 8:18 pm
by Sergey Tkachenko
Do you use TSRichViewEdit (ScaleRichView) or TRichView/TRichViewEdit?
Re: page break
Posted: Mon Oct 28, 2019 4:47 pm
by adamrich
Hello,
I use TRichViewEdit
Thank you
Re: page break
Posted: Mon Oct 28, 2019 5:37 pm
by Sergey Tkachenko
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
Re: page break
Posted: Tue Oct 29, 2019 1:43 pm
by adamrich
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
Re: page break
Posted: Tue Oct 29, 2019 1:54 pm
by Sergey Tkachenko
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.