简体   繁体   English

如何使合并范围与图像一起使用?

[英]How to make merge ranges work with images?

In the documentation I can not find anything about merging pictures within a merge range:在文档中我找不到任何关于在合并范围内合并图片的信息:

Name Price Image名称 价格 图片

«RangeStart:Products»«Name»
«Price»
«Picture:Image»«RangeEnd:Products»

Showing the products with name and price worked until I added the 3rd property Image with prefix Picture:在我添加带有前缀图片的第三个属性图像之前,显示带有名称和价格的产品一直有效:

but my images are not rendered...但我的图像没有渲染...

WHY?为什么?

my data:我的数据:

 private List<PdfProduct> GetDataList()
        {
            var products = new List<PdfProduct> {
                new PdfProduct { Name = "dodamax",  Price = 250.25, Image = File.ReadAllBytes($"./{DocumentFolder}/test1.jpg") },
                new PdfProduct { Name = "Comparex", Price = 230.25, Image = File.ReadAllBytes($"./{DocumentFolder}/test2.jpg") },
            };
            return products;
        }

How are you executing the mail merge process, note that it should be like this:你是如何执行邮件合并过程的,注意它应该是这样的:

document.MailMerge.Execute(products, "Products");

Or if that List<PdfProduct> is a part of another object that is your data source, then it should be assigned to a property that's named "Products".或者,如果该List<PdfProduct>是作为您的数据源的另一个 object 的一部分,则应将其分配给名为“Products”的属性。

Also, if you're still experiencing an issue, what version of GemBox.Document are you using?另外,如果您仍然遇到问题,您使用的是哪个版本的 GemBox.Document?
Note that older versions of GemBox.Document didn't have special handling for fields with the "Picture:" prefix.请注意,旧版本的 GemBox.Document 没有对带有“图片:”前缀的字段进行特殊处理。

Last, are you saving the result as DOCX or PDF, try saving it to both to see if the problem occurs in just one format or on both.最后,您是将结果保存为 DOCX 还是 PDF,请尝试将其保存为两种格式,看看问题是只出现在一种格式上,还是同时出现在两种格式上。

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

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