Translating strings on the fly
alnotas
Greece
Hello from Greece!
I'm trying to achieve automatic translation of each Greek word that is printed on the report to English.
I'm using the PreviewPages property of the report, right after the report has been prepared and scan through all the MemoView objects and changing it's text;
This seems to work on the preview, tranlating every static text and every field value but the problem starts when I hit print and starting to print.
The preview page flickers and all the pages' text is automatically returned to Greek and it's Greek that is printed on the paper.
It's seems the original Greek pages are being cached during preparing and are used to return to the original state after hitting 'Print'.
I tried changing some properties like
MainReport.EngineOptions.UseFileCache := true / false
MainReport.PreviewOptions.PagesInCache := 0..100
but nothing seems to work.
How can I change the RESULTED PAGES of the prepared report and print the translated result?
I'm trying to achieve automatic translation of each Greek word that is printed on the report to English.
I'm using the PreviewPages property of the report, right after the report has been prepared and scan through all the MemoView objects and changing it's text;
...
  MainReport.Prepare;
  DoTranlsateReport;
  MainReport.ShowPreparedReport;
...
procedure DoTranslateReport;
var
  p, o : integer;
  fAllObjects: TList;
  oView : TfrxMemoView;
begin
  for p:=0 to MainReport.PreviewPages.Count-1 do
  begin
      for o:=0 to MainReport.PreviewPages.Page[p].AllObjects.Count-1 do
      begin
        fAllObjects := MainReport.PreviewPages.Page[p].AllObjects;
        if TfrxComponent(fAllObjects.Items[o]) is TfrxMemoView then
        begin
            oView := TfrxMemoView(TfrxComponent(fAllObjects.Items[o]));
            oView.Text := EngTranslate(oView.Text);
        end;
      end;
  end;
end;
This seems to work on the preview, tranlating every static text and every field value but the problem starts when I hit print and starting to print.
The preview page flickers and all the pages' text is automatically returned to Greek and it's Greek that is printed on the paper.
It's seems the original Greek pages are being cached during preparing and are used to return to the original state after hitting 'Print'.
I tried changing some properties like
MainReport.EngineOptions.UseFileCache := true / false
MainReport.PreviewOptions.PagesInCache := 0..100
but nothing seems to work.
How can I change the RESULTED PAGES of the prepared report and print the translated result?
Comments
...
Nothing changed....
Any clues? Anybody?
Thank you so, SOOOO much!
It worked!