Posted: Wed May 20, 2015 7:40 am
Thanks Sergey,
But now RVStyles make me crazy
with this code I can build a table the way I want it
but I have also to insert a Blob field with RVF content in a table Cell, I've tried this:
but the style of the already inserted texts changes, and the text can disapear !!!
I've seen this comment in the sample:
is there a way to insert the styled RVF anyway ?
the purpose of all this is to show a list of RVF (stored in a DB) inside a single component (allowing scrolling, selection, etc...). Each part will be modified in an other RV then put back in the cell (and the DB)...you can think on someting like a Blog that display differents notes in a single RVF.
Thanks
But now RVStyles make me crazy
with this code I can build a table the way I want it
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
table: TRVTableItemInfo;
line : Integer;
cell : TRVTableCellData;
begin
rvs.TextStyles.Clear;
with rvs.TextStyles.Add do
begin
FontName := 'Arial';
Size := 11;
Color := clBlack;
Style := [];
end;
with rvs.TextStyles.Add do
begin
FontName := 'Arial';
Size := 11;
Color := clBlack;
Style := [fsBold];
end;
rvs.ParaStyles.Clear;
with rvs.ParaStyles.Add do
begin
Name := 'Default';
end;
with rvs.ParaStyles.Add as TParaInfo do
begin
Name := 'ReadOnly';
Options := [rvpaoReadOnly, rvpaoStyleProtect, rvpaoDoNotWantReturns];
end;
table := TRVTableItemInfo.CreateEx(0, 0, rveMain.RVData);
table.CellHSpacing := 0;
table.CellVSpacing := 0;
table.Options := table.Options - [rvtoRowSizing, rvtoColSizing];
for Line := 0 to 9 do // this will be a loop : While Query.Eof = False do
begin
// add a readonly 1 or 2 columns row
table.InsertRows(table.RowCount, 1, -1);
if table.ColCount = 0 then
table.InsertCols(table.ColCount, 2, -1);
cell := table.Cells[table.RowCount - 1, 0];
cell.Clear;
cell.AddNL('Hello World', 1, 1);
if Odd(Line) then
begin
table.MergeCells(table.RowCount - 1, 0, 2, 1, False); // ColSpan = 2
table.Cells[table.RowCount - 1, 0].AddNL(' informations', 0, -1);
end else begin
cell := table.Cells[table.RowCount - 1, 1];
cell.Clear;
cell.AddNL('informations', 0, 1);
end;
// add a readwrite 1 column row
table.InsertRows(table.RowCount, 1, -1);
table.MergeCells(table.RowCount - 1, 0, 2, 1, False);
end;
rveMain.InsertItem('Table', table);
end;
Code: Select all
Blob := Query.CreateBlobStream(Query.FieldByName('COMMENT'), TBlobStreamMode.bmRead);
try
// Cell.InsertRVFFromStream(Blob, 0, Color, nil, nil, False, nil);
Cell.LoadRVFFromStream(Blob, Color, nil, nil, nil);
finally
Blob.Free;
end;
I've seen this comment in the sample:
Code: Select all
// creating a table containing footnotes
// (we save RVF without styles, because cells do not support loading RVF with styles;
// we can do it, because we copied collections of styles, see above)
the purpose of all this is to show a list of RVF (stored in a DB) inside a single component (allowing scrolling, selection, etc...). Each part will be modified in an other RV then put back in the cell (and the DB)...you can think on someting like a Blog that display differents notes in a single RVF.
Thanks