Text alignment in TfrxCrossView

Hi all!

I'm trying to adapt the PrintTable demo for my needs. Is there a way to get different text alignments (right/left justified) for the table columns in the cross view?

Comments

  • gpigpi
    edited 2:36PM
    Try to set text alignment in the TfrxCrossView.OnPrintCell script event
  • edited 2:36PM
    gpi wrote: »
    Try to set text alignment in the TfrxCrossView.OnPrintCell script event
    Thanks for the quick answer, gpi!
    It would be difficult to get the relevant info inside the script, so I tried the OnBeforePrintCell Delphi event instead. My code looks like this:
    procedure TMyForm.frxReport1BeforePrint(c: TfrxReportComponent);
    var
      Cross: TfrxCrossView;
    begin
      if c is TfrxCrossView then
      begin
        Cross := TfrxCrossView(c);
        Cross.OnBeforePrintCell := CrossBeforePrintCell;
      end;
    end;
    
    procedure TMyForm.CrossBeforePrintCell(Memo: TfrxCustomMemoView; RowIndex, ColumnIndex, CellIndex: Integer; const RowValues, ColumnValues, Value: Variant);
    begin
      if <SomeCondition> then
        Memo.Align := baRight
      else
        Memo.Align := baLeft;
    end;
    
    However the cells are still unaligned in the preview although the Memo.Align lines are executed.
  • gpigpi
    edited 2:36PM
    Works OK in the script
    procedure Cross1OnPrintCell(Memo: TfrxMemoView; RowIndex, ColumnIndex, CellIndex: Integer; RowValues, ColumnValues, Value: Variant);
    begin
        if ColumnIndex = 0 then
        Memo.HAlign := haRight
      else
        Memo.HAlign := haLeft;                                       
    end;
    
  • edited 2:36PM
    gpi wrote: »
    Works OK in the script
    procedure Cross1OnPrintCell(Memo: TfrxMemoView; RowIndex, ColumnIndex, CellIndex: Integer; RowValues, ColumnValues, Value: Variant);
    begin
        if ColumnIndex = 0 then
        Memo.HAlign := haRight
      else
        Memo.HAlign := haLeft;                                       
    end;
    
    Ah, HAlign, not Align! Thanks!

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.