I need to write text to a table cell in a TRichView. Each word in the text may have special formatting like bold and or italic. Then I need to write the whole text to a table cell with either left, center, or right justification.
The code snippet below formats each word of the text OK, but I can't get the justification to do what I want.
If I change the third param of AddTextNL to something other than -1, I get the words on new lines. The fourth param doesn't seem have any effect on horizontal alignment.
Code: Select all
Procedure TPgraph.WriteToCell(rtfTableIn: TRVTableItemInfo; iCellRow, iCellCol: Integer);
Var
i, iRTFStyleNum, KludgeVar: Integer;
begin
rtfTableIn.Cells[iCellRow, iCellCol].Clear;
For i := 0 to FTextList.Count - 1 Do Begin
If TStyleAndText(FTextList[i]).text <> '' Then Begin
iRTFStyleNum := GetTextStyle(SSVal, TStyleAndText(FTextList[i]).Style);
rtfTableIn.Cells[iCellRow, iCellCol].AddTextNL(TStyleAndText(FTextList[i]).text, iRTFStyleNum, -1, 17);
End; {If}
End; {For}
FTextList.Clear;
End; {WriteToCell}
Thanks,[/code]