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