Hi, I'm trying to change the page orientation for all pages of a document (spanning 1-500+ pages). By default, it is in Portrait and I want to change the page setup so that it's to be Landscape, with the following code:
*******
RTFDocument.PaperDefs.Init(true);
wpPageSetup.EditBox := RTFDocument;
if wpPageSetup.Execute then begin
RTFDocument.Header.Select := [wpsec_Margins, wpsec_PageSize];
RTFDocument.PaperDefs.Init(true);
RTFDocument.ReformatAll;
RTFDocument.Invalidate;
end;
*******
This works fine for the first page, but all following pages still are still Portrait.
What other settings do I need to set to change all pages and not just the first? I also tried using the OnMeasureTextPage with the following code which did not work either:
*******
if RTFDocument.Header.Landscape then begin
PageInfo.heighttw := RTFDocument.Header.PageWidth;
PageInfo.widthtw := RTFDocument.Header.PageHeight ;
PageInfo.changed := true;
end else begin
PageInfo.heighttw := RTFDocument.Header.PageHeight;
PageInfo.widthtw := RTFDocument.Header.PageWidth ;
PageInfo.changed := true;
end;
*******
Any help would be greatly appreciated.
Luke