Create DotmatixPage in RunTime

This code create a dotmatrix page. Just for firstpage add MasterData component and Memo.
Add a small script for this memo for print ruler for any printing
procedure TForm1.Set_FR(RowCount, ColumnCount : Integer);
const// This is Importand,
// frxClass has
// fr1CharX = 9.6;
// fr1CharY = 17;
// but this size not correct size
//so I changed it. I try & its works write

    CharX = 2.57;
    CharY = 4.5;

var Page: TfrxDMPPage;
    DataBand: TfrxMasterData;
    Memo: TfrxDMPMemoView;
begin
    frxRPT_Fis.Clear;
    Page := TfrxDMPPage.Create(frxRPT_Fis);
    Page.SetDefaults;
    Page.LeftMargin := 0;
    Page.TopMargin := 0;
    Page.RightMargin := 0;
    Page.BottomMargin := 0;
    Page.PaperHeight := RowCount * CharY; // Set Page Height
    Page.PaperWidth := ColumnCount * CharX; // Set Page Width
    Page.Name := 'Page1';

    frxRPT_Fis.ScriptText.Clear;
    frxRPT_Fis.ScriptText.Add('const _Data =''..5....!10..5....!20..5....!30..5....!40..5....!50..5....!60..5....!70..5....!8'';');
    frxRPT_Fis.ScriptText.Add('procedure SBL_LabelOnAfterData(Sender: TfrxComponent);');
    frxRPT_Fis.ScriptText.Add('begin');
    frxRPT_Fis.ScriptText.Add('  if <Line> < 10 then SBL_Label.Text := ''.'' + IntToStr( <Line> ) + _Data');
    frxRPT_Fis.ScriptText.Add('  else SBL_Label.Text := IntToStr( <Line> ) + _Data');
    frxRPT_Fis.ScriptText.Add('end;');
    frxRPT_Fis.ScriptText.Add('begin');
    frxRPT_Fis.ScriptText.Add('end.');

    { add the masterdata band }
    DataBand := TfrxMasterData.Create(Page);
    DataBand.Name := 'MST_1';
    DataBand.Top := 1;
    DataBand.Height := 17;
    DataBand.Width := ColumnCount * CharX;
    DataBand.Stretched := True;
    DataBand.RowCount := RowCount;


    Memo := TfrxDMPMemoView.Create(DataBand);
    Memo.Name := 'SBL_Label';
    Memo.SetBounds(0, 0, ColumnCount, 1);
    Memo.Align := baWidth;
    Memo.Left := 1 * CharX;
    Memo.Height := 17; 
    Memo.WordWrap := False;
    Memo.OnAfterData := 'SBL_LabelOnAfterData';

//---------------------------------------------
// This parts for second page
    Page := TfrxDMPPage.Create(frxRPT_Fis);
    Page.SetDefaults;
    Page.LeftMargin := 0;
    Page.TopMargin := 0;
    Page.RightMargin := 0;
    Page.BottomMargin := 0;
    Page.PaperHeight := RowCount * CharY;
    Page.PaperWidth := ColumnCount * CharX;
    Page.CreateUniqueName;
//---------------------------------------------
    frxRPT_Fis.DotMatrixReport := True;

    frxRPT_Fis.PrepareReport;
//    frxRPT_Fis.DesignReport;
    frxRPT_Fis.ShowReport;
end;

sorry pure english

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.