How to change style font programmatically ?

edited 9:40AM in FastReport VCL 5
I try to change the font (embedded) in a pdf report depending on the language it contains.
So I assigned styles to memos that are translated and modify the styles font this way:
procedure DoReport(LReportData:TReportData);
var
  LStyle : TfrxStyleItem;
  i:integer;
begin
  with FFastReport do begin
    frxPDFExport.FileName:= LReportData.FDestFile;
    ReportTranslate.Language:= LReportData.FLanguage;
    with frxreport do begin
      LoadFromFile(LReportData.FSrcReport, True); 

      if LReportData.FLanguage='jp' then begin
        for i:=0 to Styles.Count-1 do begin
          LStyle := Styles[i];
          LStyle.Font.Name:='SimSun';
        end;
        // something needed to update styles ?
      end;

      if not PrepareReport(True) then raise Exception.Create('report generation failed');
      if not Export(frxPDFExport) then raise Exception.Create('pdf export failed');
    end;
  end;
end;

however, the .pdf still uses Arial (the font of the styles for other languages)

What should I do to re-apply the style after changing the font ?

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.