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.
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.
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.
Thanks for your patience. Please find a sample template and data file to insert documents dynamically using the Reporting Engine. Please keep in mind that the value of the document must be an URI of a publicly accessible resource from our cloud server. For example, it could be https://www.ietf.org/rfc/rfc0983.txt. You can use any URL that returns a document of one of the supported formats. Please feel free to ask for any further assistance.