I have a table with two columns and I want to insert text in the cell at row 0 and column 0. How do I find the font name and size used in the cell(0,0)?
Initially, the 0th text and the 0th paragraph styles are used.
But if the table is not empty, the cell may contain several text items of several text styles and several paragraphs of several paragraph styles.
Which one do you want to use?
I would like to use the style from the first available format. Currently, my Style component that is linked to the DBRichEdit has a font name of Arial with size 10. However, the table cell at row 0, column 0, which is blank, is formatted with a font of Times New Roman and size 12.
// Returns the style of the first text item in RVData (having empty tag)
function GetFirstTextStyleNo(RVData: TCustomRVData): Integer;
var i: Integer;
begin
Result := 0;
for i := 0 to RVData.ItemCount-1 do
if (RVData.GetItemStyle(i)>=0) and (RVData.GetItemTag(i)=0) then begin
Result := RVData.GetItemStyle(i);
exit;
end;
end;
// Returns the style of the first paragraph in RVData
function GetFirstParaStyleNo(RVData: TCustomRVData): Integer;
begin
if RVData.ItemCount>0 then
Result := RVData.GetItemPara(0)
else
Result := 0;
end;