Page 1 of 1

Add picture to paragraph with wrap

Posted: Sun Jan 24, 2021 7:06 am
by nalanfeng
Hi,
I have the following problem with adding picture to paragraph. When I insert some text and pictures into the paragraph, I want the picture to follow the text, that is, "In line with text", so I set the "wrap" value to agowInLine, but it doesn't seem to work properly. I looked at the "text wrapping" of the picture and found it is "Behind text". Maybe I'm doing something wrong, code show as below:

Code: Select all

var
  GrPic: TAXWGraphicPicture;
  Pic: TAXWPicture;
  Para: TAXWLogPara;
  DOCX: TDOCXReadWrite;
begin
  ... 
  Para := DOCX.Editor.Paras.AppendPara;
  Pic  := DOCX.Editor.Pictures.AddPicture('123.jpg');
  GrPic := TAXWGraphicPicture.Create(Pic);
  GrPic.Wrap := agowInLine;
  GrPic.Scale(0.5);
  Para.AddGraphic(GrPic);
  
  Para := DOCX.Editor.Paras.AppendPara;
  Para.AppendPlainText('Embarcadero Studio');
  
  Para := DOCX.Editor.Paras.AppendPara;
  Para.AppendPlainText('TAXWReadWriteVCL');
end; 
Image

Thanks!

Re: Add picture to paragraph with wrap

Posted: Mon Jan 25, 2021 2:17 pm
by larsa
Hello

You must use AppendPicture when you want a picture inline. Example:

Code: Select all

  Para := DOCX.Editor.Paras.AppendPara;
  Para.AppendPlainText('TAXWReadWriteVCL');
  Para.AppendPicture('123'jpg')

Re: Add picture to paragraph with wrap

Posted: Mon Feb 01, 2021 12:45 am
by nalanfeng
Using AppendPicture,this works perfectly.Thank you