简体   繁体   English

使用 Gembox Document 合并图片大小

[英]Mail merge picture size using Gembox Document

I'm using the mailmerge feature of Gembox.Document to produce reports.我正在使用 Gembox.Document 的邮件合并功能来生成报告。 I'm having issues with the sizing of a picture.我对图片的大小有疑问。

I have created a merge field inside a table cell, and I would like the picture to occupy the maximum of the cell size without changing it's aspect ratio.我在表格单元格中创建了一个合并字段,我希望图片占据单元格大小的最大值而不改变它的纵横比。

For now it's inserting the picture, but the ratio is all messed up.现在它正在插入图片,但比例都搞砸了。

I've read in the help page that I could put a shape my merge field but after many attempts I don't know how to do it, when I try to draw the shape in my word template, it doesn't go inside my merge field.我在帮助页面中读过,我可以在合并字段中放置一个形状,但经过多次尝试我不知道该怎么做,当我尝试在我的 word 模板中绘制形状时,它不在我的内部合并字段。

Can anybody help me with this?有人可以帮我吗? Either to fix the aspect ratio, or how to use the shape…要么固定纵横比,要么如何使用形状……

Cheers干杯

Take a look at the second Merge Pictures example, its input "MergePicturesWithTemplates.docx" file has MergeFields with Shapes inside.看看第二个Merge Pictures示例,它的输入“MergePicturesWithTemplates.docx”文件里面有带有ShapesMergeFields

To place a Shape inside a MergeField , draw the shape, set it as "In Line with Text", and drag it inside the field.要将Shape放置在MergeField中,请绘制该形状,将其设置为“In Line with Text”,然后将其拖动到字段内。

Now that you have a shape as a placeholder for your image, you can add switches to MergeField in order to keep the aspect ratio of the merged picture:现在您有了一个形状作为图像的占位符,您可以将开关添加到 MergeField 以保持合并图片的纵横比:

  • \x - resize resulting picture horizontally, keep the template shape's height. \x - 水平调整生成图片的大小,保持模板形状的高度。
  • \y - resize resulting picture vertically, keep the template shape's width. \y - 垂直调整生成图片的大小,保持模板形状的宽度。
  • \x \y - resize resulting picture either horizontally or vertically. \x \y - 水平或垂直调整结果图片的大小。

To add a switch, press ALT + F9 in MS Word, that will reveal field's code and then write the switch within.要添加开关,请在 MS Word 中按ALT + F9 ,这将显示字段的代码,然后在其中写入开关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM