Create table

General TRichView support forum. Please post your questions here
Post Reply
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Create table

Post by Ceprotec »

Hello Sergey.
Do you have any demo or some sample table creation and insertion of records in SRichViewEdit?
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Inserting table (TRVTableItemInfo) in TSRichViewEdit, without RichViewActions?

The demo in Demos\RVDemos\Editors\Editor 1\, menu Table.
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

Sergey, how do I only line [0.0] stay with bold text?
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you want to insert a new table with bold text in the first cell (or in the first row), and not bold in others?

Bold/not-bold is a property of text style, not table cell.
Each cell initially has one empty text string of the 0-th text style.
You can change it:

Code: Select all

table.Cells[0,0].Clear;
table.Cells[0,0].AddNL('', bold style index, 0);
Do you need an example how to insert a table where all cells have the current text style (but not bold) except for cells in the first tow, which have the current text style, but bold?
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

I do not need an example, thanks, I'm able to do, but the only doubt is that this bold style index is based on styles of RVStyle?
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, text formatting is based only on text styles.
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

OK, thanks. How do the fields become established within the table centered?
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Vertical centering in cell: Cell.VAlign.
Horizontal centering: Alignment of paragraph style.
Ceprotec
Posts: 259
Joined: Thu Oct 28, 2010 6:09 pm
Contact:

Post by Ceprotec »

Hello Sergey.

I'm not able to get the records (data) within the table (TTable) become centralized.

I use this command:

table: TRVTableItemInfo.CreateEx = (1.12 + QueryObi.RecordCount, SRichViewEdit1.RichViewEdit.RVData);
table.Color: = clNone;
table.BorderStyle: = rvtbColor;
table.CellBorderStyle: = rvtbColor;
table.BorderWidth: = 1;
table.BorderVSpacing: = 0;
table.BorderHSpacing: = 0;
table.CellBorderWidth: = 1;
table.CellPadding: = 0;
table.CellVSpacing: = 0;
table.CellHSpacing: = 0;
table.VRuleWidth: = 1;
table.HRuleWidth: = 1;


aux: = 'No. of Order';
size: = 70;
is r: = 0 to table.Rows.Count-1
is c: = 0 to table.Rows [r]. Count-1 do begin
if (r> 0) and (c = 0) then
begin
aux: = FormatFloat ('0000000 ', StrToInt (QueryObiTermo.AsString));
size: = 70;
end;

table.Cells [r, c]. BestWidth: = size;
table.Cells [r, c]. Clear;
if r = 0 then Style: = 22
else Style: = 23;
table.Cells [r, c]. AddFmt (aux, [], style, 0);
table.Cells [r, c]. Color: = clWhite;

SRichViewEdit1.RichViewEdit.InsertItem if ('', table) then
begin

end;


What command I use to centralize data into the table?
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

When calling AddFmt, specify the index of paragraph having Alignment=rvaCenter, as the last parameter.
It is the index in RVStyle.ParaStyles collection.
Post Reply