Hi,
I m trying to insert a list of TextBox, that contain an image and some text, on a document.
And I ve got some bugs :
1- All the textboxs overlays
2- Can not change the textbox background color
3- Can not fix the image size
My code
Code
I : Integer;
w, h : Integer;
RTFDataBlock : TWPRTFDataBlock;
txtobj : TWPTextObj;
wpobj : TWPObject;
Image : TWPObject;
begin
for I := 0 to 7 do
begin
WPRichText1.ActiveParagraph := WPRichText1.BodyText.AppendNewPar();
txtobj := WPRichText1.TextObjects.InsertTextBox(w,h,RTFDataBlock);
WPRichText1.ActiveParagraph.Append(txtobj);
txtobj.PositionMode := wpotPar;
txtobj.Wrap := wpwrRight;
txtobj.Mode := [wpobjRelativeToParagraph];
RTFDataBlock.RtfText.AsString := '';
RTFDataBlock.RTFProps.AttrHelper.Clear;
RTFDataBlock.RTFProps.AttrHelper.SetBGColor(clGreen); // have no effect
RTFDataBlock.RtfText.AsString := 'First name - Last name \n Description';
WPRichText1.ActiveText := RTFDataBlock;
Image := WPRichText1.InsertGraphic('someimage.jpg');
Image.HeightTW = 50; // have no effect
//Add some text around the textbox
WPRichText1.ActiveParagraph := WPRichText1.BodyText.AppendNewPar();
WPRichText1.ActiveParagraph.Append("\n");
WPRichText1.ActiveParagraph.Append("1er ligne");
WPRichText1.ActiveParagraph.Append("\n");
WPRichText1.ActiveParagraph.Append("2e ligne");
WPRichText1.ActiveParagraph.Append("\n");
end;
end;
Alles anzeigen
Any ideas on what could be wrong?