原来如此,一直没搞明白怎么玩的
@juoliii 请参阅我们的文档,了解有关使用 LINQ 报告引擎反转图像的更多信息:
https://docs.aspose.com/words/net/inserting-images-dynamically/
例如,您可以使用 base64
字符串作为 <<image [image_expression]>>
中表达式的数据。 例如,请参阅以下模板和代码:
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+d5l0uUZhA2xCtaG0Yfu5SU5H9pkni9xIyB20GVmLGMJT5nvdjngjM9XsU6eO5bJtguvA44lZF5Ce0JSkDHEkgMO48bJs0wG6lh35TLxZfe1S0kN7Mqwkv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NC2Hp0za2b2MX80rPvJZPE3n657/v7o0YZ5G5eSUyVU09suWLH4Y/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");