为什么我的图片出现在文字之前

Why does my picture appear before the text?

本文关键字:文字 我的 为什么      更新时间:2023-10-16

我正在使用Visual C 自动词,在以下代码中,我尝试插入文本,然后是图片:

// OLEParagraphs is an object of COLEParagraphs
COLEParagraph LastParagraph = OLEParagraphs.get_Last();
COLERange LastParagraphRange = LastParagraph.get_Range();
COLEInlineShapes InlineShapes = LastParagraph.get_InlineShapes();
LastParagraphRange.put_Text(_T(“See picture below:”));
InlineShapes.AddPicture(strPicFileName, COleVariant(0l), COleVariant(1l), DOCX_VARIANT_OPTIONAL);

但是,执行代码后,我发现文本总是在图片之后,而不是图片前放置,为什么?

谢谢

给定范围参数的描述(您提供docx_variant_optional的最后一个):

Optional Object. The location where the picture will be placed in the text. If the range isn't collapsed, the picture replaces the range; otherwise, the picture is inserted. If this argument is omitted, the picture is placed automatically.

我猜这与"自动放置"有关。尝试在文本之前插入占位符范围,并将其指定为位置。