Insert Image Dynamically using LINQ Reporting Engine

@alexey.noskov I am working also to insert images based on doc template through LinQ Report Engine. Could you please share this in.docx and out.docx so that I can download them.
Thanks,
Rajib.

@rajibmandal Please see the attached template and code:

string base64ImageData = @"iVBORw0KGgoAAAANSUhEUgAAAI4AAABTCAIAAADGP6iuAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAFiUAABYlAUlSJPAAAAYtSURBVHhe7dFhbuM4EITRuf8x9nT7ey4wq6CASuUjRbdExqMNCDwYbLK624l//fm9/T+w3h6L9fZYrCf9+udf3GyrsL7t+JESXrd5rO/Rb5M/lW62hVjfgx9JkNkmsb4HP5Ihts1gfRV+m4TkNon1Vfh5EpLbJNY34BcSZN5AS//K6vdgfYl/mBaSy3lFLpV8/UlY1+V/B5BcC7vG0PsQ974Y67r8j5juM7ZKbrkEc4rU6M+ZUSlHXR3IusgrzZcZW8VbbsCoIjXmHMvYVRh1QGCAdQWWAcLzNDNXnBnEPG2s7cLNIfOXYM4BgTHWFdiXkFwCK+7BzC60DKCxAhMMsQHWRdh30GVmJuXwlyr5HN6VSZ/PZGMF2hOSZ1gXYZkgMwOTK1525fwWwmPorcAEQ2yAtXkKxnlHBnxexSs8HDeSLQkxQSbpNcMDzl+Cdp/rWIsnuvTNGSWXwOQutCQkDbGE5EtofykbfVZZx/rgifoscq/Pt3lmF8JdaDHEBJl09prtRZggyIyxPmDcoXsJ7nVYNzeovYXYABoTkgcEbPx0SdvuQx3rQ07MckCxs7DmVKAREB5D7wEBQ8zOAr6vw4QDAhVN3QwtGvfmijNoAYTH0CvIWAbyjFfzvTMD2aiWPF/C+uBZFfV8rjiDFkHmJbSL7jMm+YqD+d5l0uUZhA2xCtaG0Yfu5SU5H9pkni9xIyB20GVmLGMJT5nvdjngjM9XsU6eO5bJtguvA44lZF5Ce0JSkDHEkgMO48bJs0wG6lh35TLxZfe1S0kN7MqwkvoscpfP4GTyk2MunbHMwPgVcmYd6y5sMmQGScl8C2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UyVU09suWLH4Y/8G3ZbvHtpxZS5M/t/j0I+Vf3ioGPO2MkxX15MErPrqy+MHwZwP+O+NwK9uLul156eHGersH/+hJOdlYbzPwH28pk0mf/XSG9Tav/Q3yKUvftPct1ttjsd4ei/X2WKy3x2K9PRbr7bFYb4/Fenss1ttjsd4ei/X2WKy3x2K9PRbr7bFYbw/1+9d/c2zOSqmedYwAAAAASUVORK5CYII=";

Document doc = new Document(@"C:\Temp\in.docx");
ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, base64ImageData, "myimg");
doc.Save(@"C:\Temp\out.docx");

in.docx (15.4 KB)
out.docx (12.7 KB)

Hi Alexey,
We need to render an SVG file into word doc. We are using Linq report engine.
Initially I converted SVCG into byte array but it is displaying bitmap image which is not vector images.
Could you please share an example code with doc template to achieve SVG file render properly.

Thanks,
Rajib.

@rajibmandal As I can see upon inserting SVG image into the document using LINQ Reporting Engine, the image is inserted as EMF metafile. So the inserted image is still vector after inserting. Do you observe another behavior? If so, please provide your input and output files here for our reference.

@alexey.noskov
SVG-Test.zip (46.0 KB)

Hi Alexey,
Please find the zip file. I have tried to render both PNG and SVG using byte array. Please review the SVG rendering approach. Is it ok to render SVG with byte-array to preserve vector graphics for SVG.

Thanks,
Rajib.

@rajibmandal As I can see SVG is vector EMF in your output document. So everything works as expected.