Page 2 of 2

Posted: Wed Aug 14, 2013 11:59 am
by Sergey Tkachenko
There are two ways to apply this formatting to the header:
1) Apply "courier + right alignment" to 'header' style template, so text will be courier + right aligned by default.
2) Leave 'header' style template as it is, but apply "courier + right alignment" to text on top of a style template.

Which one do you prefer?

Posted: Wed Aug 14, 2013 12:10 pm
by Ceprotec
Option 1

Posted: Wed Aug 14, 2013 2:23 pm
by Ceprotec
problem solved,
thanks again

Posted: Wed Aug 14, 2013 2:32 pm
by Ceprotec
I have many questions yet. kkk
The function FillFields transforms tags (for example {Name}) I include by the event onPaintPage? If yes, how do?
For now I have only:

Code: Select all

FillFields (SRichViewEdit1.RichViewEdit.RVData) / / / body text
SRichViewEdit1.RichViewEdit.Format;
FillFields (SRichViewEdit1.RVHeader.RVData) / / / Header
SRichViewEdit1.RVHeader.Format;
FillFields (SRichViewEdit1.RVFooter.RVData) / / / footer
SRichViewEdit1.RVFooter.Format;
and the tests did not replace.

Posted: Thu Aug 15, 2013 7:09 am
by Sergey Tkachenko
If you use RichViewActions (TrvActionNew for creating a new document), changing the default header font is very simple.
rvActionNew1.StyleTemplate contains a list of styletemplates that will be applied to new documents.
A styletemplate named 'header' is included there by default. You can change its properties

Code: Select all

st := rvActionNew1.FindItemByName('header');
st.TextStyle.FontName := 'Courier New';
st.ValidTextProperties :=st.ValidTextProperties+[rvfiFontName];
st.ParaStyle.Alignment := rvaRight;
st.ValidParaProperties :=st.ValidParaProperties+[rvpiAlignment];

Posted: Thu Aug 15, 2013 7:10 am
by Sergey Tkachenko
Your code must work, but I would write:

Code: Select all

FillFields (SRichViewEdit1.RichViewEdit.RVData) / / / body text 
FillFields (SRichViewEdit1.RVHeader.RVData) / / / Header 
FillFields (SRichViewEdit1.RVFooter.RVData) / / / footer 
SRichViewEdit1.Format;

Posted: Thu Aug 15, 2013 11:25 am
by Ceprotec
this is my code in the event OnPaintPage

Code: Select all

Canvas.Brush.Style := bsClear;
Canvas.Font.Style  := [fsBold]; // negrito
Canvas.Font.Size   := 20; // tamanho fonte 20
Canvas.Font.Name   := 'Arial'; // letra

// Drawing header
H := SRichViewEdit1.TopMargin100Pix;
Text := '{TRASLADO}';

Canvas.FillRect(Rect(PageRect.Left, PageRect.Top, PageRect.Right, PageRect.Top + H));
Canvas.TextOut((PageRect.Left + 600 +PageRect.Right - Canvas.TextWidth(Text)) div 2, PageRect.Top - 30 + H div 2, Text);
and in the function FillFields it is:

Code: Select all

   if FieldName='TRASLADO' then
   begin
       result := '*****';
   end;
but not finding the word TRASLADO to replace.
What do am I doing wrong?

Posted: Thu Aug 15, 2013 4:00 pm
by Sergey Tkachenko
Please send me a sample project (as simple as possible) to richviewgmailcom

Posted: Fri Aug 16, 2013 2:46 pm
by Ceprotec
I found another solution, as I include a table at runtime with three columns, in the event OnPaintPage? can you give some example?

thanks