How to get the text of first line
-
- Posts: 3
- Joined: Thu Dec 21, 2006 5:04 am
How to get the text of first line
I want to save file and use the first line text as the filename,How to get the text of first line like word does ?
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Code: Select all
uses CRVData, RVTable;
function GetFirstLineText(RVData: TCustomRVData): String;
var i: Integer;
begin
i := 0;
if RVData.GetItemStyle(i)=rvsListMarker then
inc(i);
if RVData.GetItemStyle(i)=rvsTable then
Result := GetFirstLineText(TRVTableItemInfo(RVData.GetItem(i)).Cells[0,0].GetRVData)
else begin
Result := '';
while (i<RVData.ItemCount) and
((i=0) or not RVData.IsFromNewLine(i)) and
(RVData.GetItemStyle(i)>=0) do begin
Result := Result + RVData.GetItemTextA(i);
inc(i)
end;
end;
end;
// call
s := GetFirstLineText(RichViewEdit1.RVData);
Last edited by Sergey Tkachenko on Mon Dec 25, 2006 5:31 pm, edited 1 time in total.
-
- Posts: 3
- Joined: Thu Dec 21, 2006 5:04 am
Thanks for help
but it always return the empty string, is there anything I miss ?
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: