Dear Aspose Support,
apparently I cannot get this command to work properly:
re.buildReport(hf, data, "body");
What is the intention: data contains a Document object which I want to be included in the main template using the <<doc>>
LINQ tag.
Please find attached a minimal running example.
AposeForum_DocInsertion.zip (50.4 KB)
Could you provide some hints about what I am doing wrong?
Based on documentation this should be definitely possible to pass a Document object (or even an input stream) to buildReport() to make subdocuments available to the reporting engine.
Thanks for the attention
FV
@fabrizio.vaglia
It sounds like you’re trying to insert a Document object into another document using the ReportingEngine, but you’re encountering some issues with the re.buildReport(hf, data, "body");
command.
Cause: The problem may stem from incorrect data types, improper LINQ tag usage, or issues with the Document object’s structure.
Solution: Here are specific steps to troubleshoot the problem:
-
Ensure Correct Data Type: Confirm that the data
parameter you are passing to buildReport
is indeed a Document object. If it’s not, the ReportingEngine won’t process it correctly.
-
LINQ Tag Usage: Verify that you are using the correct LINQ tag in your template. The tag should be <<doc>>
for inserting a document. Check for any typos or formatting issues in your template.
-
Document Structure: Review the structure of the Document object you are trying to insert. It should be properly formatted and free of elements that could cause issues during insertion.
-
Debugging: Add logging or debugging statements before the buildReport
call to confirm that the data
object is as expected.
-
Minimal Example: Since you have a minimal running example, isolate the issue further by simplifying it. Remove unnecessary code and focus solely on the insertion part to see if the problem persists.
Next Steps: If you follow these steps and still encounter issues, please share any error messages or unexpected behavior you experience. This information will assist in diagnosing the problem more effectively.
Let me know if this resolves your issue!
Dear bot and fellow supporters,
all provided recommendations have been already implemented till now.
So now waiting for some additional insights from your side,
Kindest Regards
FV
@fabrizio.vaglia There is <<doc [body.docx]>>
(white font) tag that causes the problem. if change it to <<doc [body]>>
everything works as expected with the following code:
Document doc = new Document("C:\\Temp\\HF_LINQ.docx");
ReportingEngine engine = new ReportingEngine();
engine.buildReport(doc, "C:\\Temp\\body.docx", "body");
doc.save("C:\\Temp\\out.docx");
HF_LINQ.docx (26.0 KB)
out.docx (19.4 KB)
Please see our documentation for more information:
https://docs.aspose.com/words/java/inserting-documents-dynamically/
Hi @alexey.noskov ,
thank you for the answer and it is actually working.
Thanks for the support,
Kindest regards
1 Like