Julian
I'm using your label demo as a basis but I'm having some trouble with setting things as I want. In addition to setting the WPSuperprint dimensions and margins I'm trying to set the label document margins so that I can place the text nicely in the middle of the label rather than starting at the top left corner.
It works BUT if I alter the WPSuperPrint margins etc after setting the page margins the left page margin is retained but the top page margin is reset to 0. The code I'm using is
Code
procedure TLabelSetupForm.ColCountChange(Sender: TObject); function MMasTwips(Value: Extended): integer; begin Result := round(Value * MMToTwips); end;begin if FLocked then exit; WPSuperPrint1.PageWidth := MMasTwips(PageWidth.Value); WPSuperPrint1.PageHeight := MMasTwips(PageHeight.Value); WPSuperPrint1.Rows := Trunc(RowCount.Value); WPSuperPrint1.Columns := Trunc(ColCount.Value); WPSuperPrint1.MarginTop := MMasTwips(TopMargin.Value); WPSuperPrint1.MarginLeft := MMasTwips(LeftMargin.Value); WPSuperPrint1.MarginRight := MMasTwips(RightMargin.Value); WPSuperPrint1.MarginBottom := MMasTwips(BottomMargin.Value); WPSuperPrint1.InbetweenHorz := MMasTwips(HorzMargin.Value); WPSuperPrint1.InbetweenVert := MMasTwips(VertMargin.Value); DemoLabel.SelectAll; DemoLabel.Header.SetPageWH(WPSuperPrint1.Width, WPSuperPrint1.Height, MMasTwips(LabelLeft.Value), MMasTwips(LabelTop.Value), 0, 0); Demolabel.HideSelection; DemoLabel.ReformatAll(False, True); end;
If I reset the top margin it all works again
Code
procedure TLabelSetupForm.LabelMarginChange(Sender: TObject);
begin
DemoLabel.SelectAll;
if Sender = LabelLeft then begin
DemoLabel.Header.LeftMargin := Trunc(LabelLeft.Value * MMToTwips);
end else begin
DemoLabel.Header.TopMargin := Trunc(LabelTop.Value * MMToTwips);
end;
DemoLabel.HideSelection;
DemoLabel.ReformatAll(False, True);
WPSuperPrint1.Update;
end;
Alles anzeigen
Any suggestions?