how to change the font' size to fit frxmemoviem

The frxmemoview's stretchmode was setted smdontstretch and countnot to be changed,and the content would be auto fit the memo,
how to change the font'size based on the contents length and auto wordwrap?

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 5:04AM
    it depends upon what your memo contains
    ie [datafield] or [variable] or [expression] or just text.
    assuming it contains one of the first 3 above
    use obp event of either memo or band, write code using the lengthfunction to test the contents of the data field in a case statement using some ranges to set the memos font.fontsize property.
    begin
    case [length(<dataset."fieldname">] of
    1..10: memo1.font.fontsize := 10;
    11..20: memo1.font.fontsize := 8;
    else
    memo1.font.fontsize := 6;
    end;
    ;)
  • edited 5:04AM
    but it's not enough and limited
    i want to have a genaral procedue to set it
    eg. adjust the frxcustommemoview 's width or height on the memo
    because contans maybe are multi-linse but not a bigger length
  • edited 5:04AM
    I test it ok at static report but I get data from Variables and despend on Report's OnGetValue event , it is no effect!!

    procedure TMemo1.OnBeforePrint(Sender: TfrxComponent)
    begin
    while (TfrxMemoView(Sender).CalcHeight>TfrxMemoView(Sender).Height) do
    begin
    TfrxMemoView(Sender).Font.Size := TfrxMemoView(Sender).Font.Size-1;
    end;
    end;

    why??
  • edited 5:04AM
    I moved these codes to OnAfterDataEvent and It works fine

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.