How to get the text of first line
Posted: Sun Dec 24, 2006 1:11 am
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 ?
Support forums for TRichView, ScaleRichView, Report Workshop and RVMedia components
https://richedit.com/forums/
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);