Page 1 of 1
TRVTextItemInfo
Posted: Fri Aug 17, 2007 1:21 pm
by MichaelS
Hello,
I'm iterating a table with his cells. In a cell I have different TCustomRVItemInfo classes. Now I have to extract from every cellitem, which is a TRVTextItemInfo, the RVData into a Stream.
Do you have a fast solution for me? Thanks in Advance!
Yours,
Michael
Posted: Fri Aug 17, 2007 2:02 pm
by Sergey Tkachenko
Sorry, I do not understand. Can you explain in another words?
Posted: Sun Aug 19, 2007 8:59 am
by MichaelS
Hello,
Sorry, my englisch isn't so good. Here my problem in another words:
I have a TRichViewEdit component, which contains a table with formatted text. Now I would like to extract, for each tablecell the formatted text into a RV-Stream.
Here a example:
Code: Select all
var
intIndex: Integer;
objData: TRVEditRVData;
objItem: TRVTableItemInfo;
objCell: TRVTableCellData;
intRow: Integer;
intCol: Integer;
intCount: Integer;
begin
objData := TRVEditRVData(rvEdit.RVData);
for intIndex := 0 to rvEdit.ItemCount-1 do
begin
if objData.GetItem(intIndex) is TRVTableItemInfo then
begin
objItem := TRVTableItemInfo(objData.GetItem(intIndex));
for intRow := 0 to objItem.RowCount -1 do
begin
for intCol := 0 to objItem.ColCount - 1 do
begin
objCell := objItem.Cells[intRow, intCol];
for intCount := 0 to objCell.ItemCount - 1 do
begin
if objCell.GetItem(intCount) IS TRVTextItemInfo then
begin
// => here save for each TRVTextItemInfo the RV-Text
end;
end;
end;
end;
end;
end;
end;
Thanks in Advance.
Yours,
Michael
Posted: Mon Aug 20, 2007 11:14 am
by Sergey Tkachenko
Code: Select all
var
intIndex: Integer;
objData: TRVEditRVData;
objItem: TRVTableItemInfo;
objCell: TRVTableCellData;
intRow: Integer;
intCol: Integer;
intCount: Integer;
begin
objData := TRVEditRVData(rvEdit.RVData);
for intIndex := 0 to rvEdit.ItemCount-1 do
begin
if objData.GetItem(intIndex) is TRVTableItemInfo then
begin
objItem := TRVTableItemInfo(objData.GetItem(intIndex));
for intRow := 0 to objItem.RowCount -1 do
begin
for intCol := 0 to objItem.ColCount - 1 do
begin
objCell := objItem.Cells[intRow, intCol];
[color=blue] if objCell=nil then
continue;[/color]
for intCount := 0 to objCell.[color=blue]GetRVData.[/color]ItemCount - 1 do
begin
if objCell.[color=blue]GetRVData.[/color]GetItem(intCount) IS TRVTextItemInfo then
begin
[color=blue]{ Use objCell.GetRVData.GetItemTextA(intCount) }[/color]
end;
end;
end;
end;
end;
end;
end;
Posted: Mon Aug 20, 2007 11:16 am
by Sergey Tkachenko
In addition, you can:
- for TRVTabItemInfo items, add #9 in text
- if objCell.GetRVData.IsFromNewLine(intCount), add #13#10
Posted: Mon Aug 20, 2007 12:58 pm
by MichaelS
Hello Sergey,
it works fine! Thanks a lot!
Yours,
Michael