Board index » delphi » How do Insert a page-break in Word?

How do Insert a page-break in Word?

How do Insert a page-break in Word?
 

Re:How do Insert a page-break in Word?


Quote
"Magnus Holmberg" <magnus.holmb...@pepto.se> wrote:
>How do Insert a page-break in Word?

I have a function which can insert different types of breaks:

// Insert Break - break type can be either "Page", "SectionNext", "SectionCurrent" or "Line"
procedure insertbreak(worddoc: TWordDocument; breakstyle: string);
var
  pbreak: OleVariant;
begin
  try
    with worddoc.Application do
      begin
        if (pos('page',lowercase(breakstyle))<>0) then
          pbreak:=wdPageBreak
        else if (pos('sectionnext',lowercase(breakstyle))<>0) then
          pbreak:=wdSectionBreakNextPage
        else if (pos('sectioncurrent',lowercase(breakstyle))<>0) then
          pbreak:=wdSectionBreakContinuous
        else if (pos('line',lowercase(breakstyle))<>0) then
          pbreak:=wdLineBreak;
        selection.InsertBreak(pbreak);
      end;
  except
    on E:exception do showmessage('Error in Word API procedure insertBreak: '+E.Message+' ('+inttostr(E.HelpContext)+')');
  end;
end;

Best,
Dave

replace NOSPAM with eims to reply.

Other Threads