Hello,
I saw on the documentation that the syntax for defining a variable is:
<<var [s = “Hello!”]>><<[s]>>
I tried the same code on a completely blank document but the system returns error is there something I’m missing?
Thanks you
Which Aspose API you are using, could you please share your sample code that you are using? We will check it and assist you soon.
The code I used is only this:
<<var [s = “Hello!”]>><<[s]>>
We are using Aspose version: 16.12
Thanks you,
Are you using Aspose.Words 16.12 or Aspose.PDF 16.12 API? Also, share the documentation link from which you are trying the sample code.
Hello Thanks you for your support.
I am using Aspose.Words 16.12 the code I’m trying comes from here: Using Variables in Java|Aspose.Words for Java
@TizianoSacchi Thank you for additional information. I have checked and this works fine with the latest 22.1 version of Aspose.Words for Java. I have used the following template syntax:
<<var [s = “Hello!”]>><<[s]>>
And the following simple code:
Document doc = new Document("C:\\Temp\\in.docx");
ReportingEngine engine = new ReportingEngine();
engine.buildReport(doc, new Object());
doc.save("C:\\Temp\\out.docx");
Here is my input and output documents in.docx (11.9 KB)
out.docx (9.5 KB)