WPCubed Product Support

Problems with header and footer within sections

Hi,

I'm trying to make a preview of several letters. These letters, I first concatenate to 1 WPCustomRichText, each letter in 1 section.
The header I want to put at the first page of each letter and the footer at the last page of each letter WITHIN every section. But it shows only the first header of the first section and the last footer of the last section.
This worked fine with a older version of WPTools5 (2006), but not with the latest version. (How) can I fix this? I'm using Delphi 5.

Dirk.

Example with 2 letters (and thus 2 sections):

procedure TForm1.btnTestPreview1Click(Sender: TObject);
var
  par:TParagraph;
  wpall,wp1,wp2:TWPCustomRichText;
begin
  wpall := TWPCustomRichText.CreateDynamic;
  wp1   := TWPCustomRichText.CreateDynamic;
  wp2   := TWPCustomRichText.CreateDynamic;

  // DOC 1
  par := wp1.FirstPar;
  par.SetText('HEADER 1');
  wp1.HeaderFooter.Get(wpHeader,wpraOnFirstPage,'HEADER 1').AppendPar(par);

  par := wp1.ActiveText.AppendNewPar(True);
  par.SetText('BODY 1');

  par := wp1.ActiveText.AppendNewPar(True);
  par.SetText('FOOTER 1');
  wp1.HeaderFooter.Get(wpFooter,wpraOnLastPage,'FOOTER 1').AppendPar(par);

  // DOC 2
  par := wp2.FirstPar;
  par.SetText('HEADER 2');
  wp2.HeaderFooter.Get(wpHeader,wpraOnFirstPage,'HEADER 2').AppendPar(par);

  par := wp2.ActiveText.AppendNewPar(True);
  par.SetText('BODY 2');

  par := wp2.ActiveText.AppendNewPar(True);
  par.SetText('FOOTER 2');
  wp2.HeaderFooter.Get(wpFooter,wpraOnLastPage,'FOOTER 2').AppendPar(par);

  wpall.AppendAsSection(wp1);
  wpall.AppendAsSection(wp2);

  wpall.ReformatAll(true);
  // PREVIEW
  with TWPPreviewDlg.Create(Application) do
  begin
    EditBox:= wpall;
    Execute;
    Free;
  end; // WITH
  FreeAndNil(wp1);
  FreeAndNil(wp2);
  FreeAndNil(wpall);
end;
#1 ♥ 0
4.9k Views 3 users read 2 min

Were you able to get this to work? I need something similar.

#2 ♥ 0
support

Hi,

wpraOnLastPage is a speciality of WPTools - it is not suppoted by other RTF reader and cannot be used in sections either.

I would recommend to create named header and footer and activate them in the OnGetSpecalText event according to the needs.

That event gets a pointer to the current page (TWPVirtPage) which has the property SectionID to be used to select the correct header or footer.

Julian

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