简体   繁体   中英

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".

Also, if you're still experiencing an issue, what version of GemBox.Document are you using?
Note that older versions of GemBox.Document didn't have special handling for fields with the "Picture:" prefix.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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