Insert image by base64 string

Hi support team,

I would like to know if is it possible to insert base64 string to docx with Linq report engine. I don’t see any documentation about this scenario especially with Json Data source. For example:

{
  "badges": [
    "base64String1",
    "base64String2",
    "base64String3"
  ]  
}

Kind Regards.

@binhsyncr

Could you please provide more details about how you intend to use the base64 strings in the Linq report engine? Are you looking to insert them as images in specific locations within the document?

Yes. I would like to put some tags like <<foreach [in badges]>><<[badges_Text]>><</foreach>>.

@binhsyncr Please see our documentation to learn how to insert image:
https://docs.aspose.com/words/net/inserting-images-dynamically/

Please see the following simple code example:

JsonDataSource ds = new JsonDataSource(@"C:\Temp\data.json");

Document doc = new Document(@"C:\Temp\in.docx");

ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, ds);

doc.Save(@"C:\Temp\out.docx");

in.docx (15.3 KB)
data.zip (10.7 KB)
out.docx (11.2 KB)

Thx it works.

1 Like