We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

Inserting Documents Dynamically Using the Reporting Engine

I am trying to insert documents dynamically using the reporting engine using PHP; https://docs.aspose.com/words/net/inserting-documents-dynamically

I’m trying to insert a document using the following syntax:
<<doc “template1.docx”>>
But I am getting Error: BuildReportOnline. Exception: Error while build report => Tag ‘doc’ is not well-formed. Character ‘‘’ is unexpected…

I’ve tried various other expresions, no quotes, double quotes, square brackets with quotes - but none of them work - what is the correct format when using a path?

I’m also confused as to where the inserted documents should live - do I need to upload them as well or should they already exist in the storage and is their path relative to the root of the storage?

The code I’m using is relatively straighforward and works when not using the <<doc syntax:

$data = file_get_contents(__DIR__."/data.json");
$settings = new ReportEngineSettings(array("data_source_type" => "Json"));
$request = new BuildReportOnlineRequest(__DIR__."/dynamic_doc_template.docx", $data, $settings);
$result = $wordsApi->buildReportOnline($request);
rename($result->getPathname(), "result.docx");


Please note that the field code should be formatted as follows. And the BuildReportOnline API method expect file from local paths. However, I noticed that the feature is not working as expected. So I logged a ticket (WORDSCLOUD-2160) for further investigation and rectification. We will notify you as soon as it is resolved.

Field code in the template : <<doc [Document]>>


Thanks for the quick response.
Can you include a code example when the issue is fixed please becuase I’m still unsure where the documents to be inserted should live - in my online storage folder or locally with the code I’m using to call the method.


Sure, once the issue is fixed, we will share sample code along with the template and data as well.

Hello, I’m just looking for an update on this fix - is it still in the pipeline or has it been done, thanks.


The above logged ticket is still unresolved; it is pending in the queue for investigation. We will share an update/ETA once the issue investigation is completed.