Fastreport’s Tfrxrichview changing color on its own in Delphi XE?

Asked

Viewed 643 times

2

I searched the web but found nothing in this sense, there must be some bug in the component TfrxRichView of Fastreport 5.1.9, when placing this component and setting the background color it accepts normal, but when it has printed at development time it simply stays with white background (default) and more, it even removes the component’s color selection, this also occurs at runtime.

Even though it forces the color to change OnBeforePrint he ignores, someone has already gone through it and had a solution?

The scenario is Delphi XE with Fastreport 5.1.9

  • Compiled for Mobile or Descktop?

  • Desktop, I thought it might be a limitation of Tfrxrichview since it accepts text formatting, but ai would not make sense that this property be there

1 answer

1

Make sure your color formatting is correct:

First of all check if the amount accepted by the color should be in the format hexadecimal, TAlphaColor or RGB.
You can do this by saving the file with this property, opening the generated file with end fr3 and analyzing the text after the tag <Color>, then you can see the expected color format.


Plus I see two ways you can solve this:

1st Way

  • Make all the static changes you want and save the view as a file FR3.
  • In the form you want to use the report put a component TfrxReport blank.
  • When you activate this report view use NomeDoReport.LoadFromFile(Caminho + NomeDoReport.fr3);
  • Show the View with NomeDoReport.Show;

2nd way

  • Get Report ready or load it as the 3rd step in the first way
  • Declare a variable TfrxMemoView in your Form code
  • Assign the properties of the desired object to that variable via code: NomeDoMeuMemoView := NomeDoReport.FindObject('NomeDoObjetoDesejado') as TfrxMemoView;
  • Access the desired properties using NomeDoMeuView.NomeDaPropriedade := 'ValorNovo';
  • When you change everything you want Prepare Report NomeDoReport.PrepareReport;
  • Show the report prepared with NomeDoReport.ShowPreparedReport;

Example of the First Way:

[...] //cabeçalho do Delphi e outras variáveis
ExemploReport: TfrxReport;
[...] //implementation, outras procedures e functions
procedure TfmxForm1.MostraReportCarregado;
begin
ExemploReport.LoadFromFile(Caminho + 'ExemploReport.fr3');
ExemploReport.Show;
end;

Example of the 2nd Way:

[...] //cabeçalho do Delphi e outras variáveis
ExemploReport: TfrxReport;
ObjetoExemploReport: TfrxMemoView;
[...] //implementation, outras procedures e functions
procedure TfmxForm1.MudaCabeçalhoReport;
begin
ExemploReport.PrepareReport(True); //aqui estou preparando o report para edição
RadiusReport.LoadFromFile(Caminho + 'ExemploReport.fr3');
ObjetoExemploReport := ExemploReport.FindObject('NomeDoObjeto') as TfrxMemoView;
ObjetoExemploReport.Text := 'Texto Mudado';
ExemploReport.PrepareReport;
ExemploReport.ShowPreparedReport;
end;

Considerations

The first way is easier to implement in your system, but it is tied to static values, a great alternative if you want to avoid errors and want a quick implementation, but the second way changes the properties in Runtime, that is, opens space for possibilities of customization by the system user.

  • Considering this part "value accepted by color must be in hexadecimal format", the color value comes from the component’s own combo, so it can not be wrong, save some bug.

  • Taking the examples, I will make the amendments see the results and put here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.