CellBorderColor change after save (rtf) ...

General TRichView support forum. Please post your questions here
Post Reply
Crowbar
Posts: 82
Joined: Wed Oct 11, 2006 8:54 pm
Location: Germany

CellBorderColor change after save (rtf) ...

Post by Crowbar »

Hi,
I would like to change the CellBorderColor of a table in my RichViewEdit.
This works. But ...
I save the RichViewEdit into a file (rtf-Format) and load this file again.
Now, I can change the CellBorderColor no more (but the CellBorderWidth can change I)!
Here my code:

Code: Select all

...
Table:=TRVTableItemInfo.CreateEx(r,c,RichViewEdit.RVData);
with Table do
 begin
    Color:=clNone;
    CellBorderColor:=clBlack; 
    CellBorderStyle:=rvtbColor;
    BorderWidth:=0;
    BorderVSpacing:=0;
    BorderHSpacing:=0;
    CellBorderWidth:=1;  
    CellVSpacing   :=-1;
    CellHSpacing   :=-1;
    for r:=0 to RowCount-1 do
     for c:=0 to ColCount-1 do
      if Cells[r,c] <> nil then
       begin
          Cells[r,c].Clear;
          Cells[r,c].AddNLATag('',RichViewEdit.CurTextStyleNo,RichViewEdit.CurParaStyleNo,0);
       end;
 end;
RichViewEdit.InsertItem('',Table);
...
RichViewEdit.SaveRTF('test.rtf',false);
...
Now, I load the rtf-file and would like the CellBorderColor on green and the CellBorderWidth on 5 change.

Code: Select all

...
RichViewEdit.Clear;
RichViewEdit.LoadRTF('test.rtf');
RichViewEdit.Format;
...
RichViewEdit.GetCurrentItemEx(TRVTableItemInfo,rve,Item);
Tabelle:=TRVTableItemInfo(Item);
Tabelle.CellBorderColor:=clGreen;
Tabelle.CellBorderWidth:=5;
...
The CellBorderWidth is change, but not the CellBorderColor.
What I do incorrectly?

Crowbar
Sergey Tkachenko
Site Admin
Posts: 17357
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Border colors of individual cells are assigned.
Crowbar
Posts: 82
Joined: Wed Oct 11, 2006 8:54 pm
Location: Germany

Post by Crowbar »

Mean it, that the border color no more it can be changed (after load the rtf-File)?
Sergey Tkachenko
Site Admin
Posts: 17357
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

The border colors for table.Cells[r,c] are defined by the following properties:
1) table.Cells[r,c].BorderColor, table.Cells[r,c].BorderLightColor. By default, these properties are equal to clNone, meaning: use the default cell border colors, defined in (2)
2) table.CellBorderColor, table.CellBorderLightColor - the default cell border colors.

After reading from RTF, table.Cells[r,c].BorderColor and table.Cells[r,c].BorderLightColor <> clNone for all cells (may be it will be changed in future), so table.CellBorderColor and table.CellBorderLightColor do not affect cell border colors.

To change cell borders, change table.Cells[r,c].BorderColor and table.Cells[r,c].BorderLightColor for all cells.
Post Reply