‌JSON base64 image and Word Template Output

‌JSON base64 image and Word Output

The JSON content is: {"imgBase64str":"iVBORw0KGgoAAAANSU......"}.

In Word, the output statement is: <<image [imgBase64str]>>,
return error:
code: ‘ErrorInvalidInputData’,
description: ‘Operation Failed. The input data is not valid.’,
innerError: [ApiError],
message: ‘Error while build report’

base64str is normal:

@chongpeng I tested with the following data and template:
in.docx (15.3 KB)
data.zip (346 Bytes)

Using the following simple code:

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");

The images is properly inserted into the document:
out.docx (11.2 KB)

1 Like

@alexey.noskov Thank you very much.

Yes, I used the test file you provided, and it works normally.

I also found the reason for the failure: “Tag ‘image’ is not well-formed. Tag ‘image’ must be located within an image container.”

Thank you again.

1 Like