Cross View (TfrxCrossView) fonts

edited 6:41AM in FastReport 4.0
Hi

I need to change just the first row of data in a cross view. I'm adding the data to the cross view at ..ReportBeforePrint()

procedure TReportDesignerPreviewForm.FastReportBeforePrint(Sender: TfrxReportComponent);
begin
if Sender is TfrxCrossView then
begin
ExpandCrossView(Sender as TfrxCrossView);
end;

... etc ...

How can I modify the font settings of just some cells in the grid? This should be easy so I'm missing something obvious! HELP [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> ACrossView.CellMemos[0].Font.Size := 20; Sets all items to font size 20. Thanks[/img]

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 6:41AM
    here is a sample
    procedure TForm1.Button4Click(Sender: TObject);
    var
    mycross: tfrxcrossview;
    cm: tfrxcustommemoview;

    begin
    frxreport2.LoadFromFile(wpath + '60.fr3');
    mycross :=frxreport2.findobject('cross1')as tfrxcrossview;
    mycross.CellFunctions[0]:= cfsum;
    cm:= mycross.CellMemos[0];
    cm.Font.Size := 18;
    cm.DisplayFormat.Kind := fknumeric;
    cm.DisplayFormat.FormatStr :='%2.2m';
    frxreport2.ShowReport;
    end;
  • edited 6:41AM
    Hi

    I'm already doing that but when I do it changes the entire table contents to font size 20.

    Any ideas?

    Thanks
  • edited 6:41AM
    Any ideas?

    What I need to do is change the formatting (font, bold, style) of some 'cells' in a cross view. For example:

    Col 1 | Col 2 | Col 3 |
    va1 | val | val |
    va1 | val | val |

    I want "Col 1", "Col 2" and "Col 3" bold while the rest of the table must be normal. Is this possible?
  • edited 6:41AM

    ...and also. If I'm using the before print method of a fast report object, how can I assign my own OnPrintCell to a TfrxCrossView or is this only available in script?

    procedure TReportDesignerPreviewForm.FastReportBeforePrint(Sender: TfrxReportComponent);
    var
    CV : TfrxCrossView;
    begin
    if Sender is TfrxCrossView then
    begin
    CV := Sender as TfrxCrossView;
    CV.OnPrintCell := ????????



  • gordkgordk St.Catherines On. Canada.
    edited 6:41AM
    only in internal script.
  • edited 6:41AM

    mmmm... another major weakness in FastReport I'm afraid... I think a lot of people are using code to create on the fly reports and running into problems. Oh well >
  • edited 6:41AM
    "only in internal script" Ok, so how???

    I don't know how many cross views will be on the report as the user can select as many as they want. I need to then modify the cross views in script so that some cells fonts are bold or a different colour. Any code snippets on how to do this?

    Thanks...
  • edited 6:41AM

    Is there a way in script that I can iterate through (list) all the controls on the report?
  • edited 6:41AM
    Ok so I've tried to add this to the script of the report:

    procedure FastReportOnStartReport(Sender: TfrxComponent);
    var
    i, p, c, m : Integer;
    AReport : TfrxReport;
    APage : TfrxReportPage;
    AMasterData : TfrxMasterData;
    ACrossView : TfrxCrossView;
    Component : TfrxComponent;
    begin
    if Sender is TfrxReport then
    begin
    AReport := TfrxReport(Sender);

    for p := 0 to AReport.Objects.Count-1 do
    begin
    if AReport.Objects[p].ClassName='TfrxReportPage' then
    begin
    APage := TfrxReportPage(AReport.Objects[p]);

    for c := 0 to APage.Objects.Count-1 do
    begin
    Component := TfrxComponent(APage.Objects[c]);

    if Component is TfrxMasterData then
    begin
    AMasterData := TfrxMasterData(Component);

    if AMasterData.Objects[0] is TfrxCrossView then
    begin
    ACrossView := TfrxCrossView(AMasterData.Objects[0]);
    ACrossView.OnPrintCell := CrossOnPrintCell;
    end;
    end;
    end;
    end;
    end;
    end;
    end;

    procedure CrossOnPrintCell(Memo: TfrxMemoView; RowIndex, ColumnIndex, CellIndex: Integer; RowValues, ColumnValues, Value: Variant);
    begin

    end;

    However I get the "Not enough actual parameters" error from the "ACrossView.OnPrintCell := CrossOnPrintCell;" assignement.

    So near yet so far >

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.