Reputation: 95
I'm using Aspose Java to generate docx files based on a temaplte and I'm facing a problem on my generation.
I do this :
ReportingEngine engine = new ReportingEngine();
engine.buildReport (templateDoc, resumedata, "resumedata");
Where resumedata (with lombok getter/setter) is:
@Data
@AllArgsConstructor
public class ResumeData {
private String firstname;
private String lastname;
private String summary;
private List<UserLanguage> userLanguage;
}
Then in my temaplte document I try to display information. I've tried several options but none of them work.
<<[resumedata.getSummary()]>>
, <<[getSummary()]>>
, <<[summary]>>
.
None of them works. I've always the following error :
Api error 500 INTERNAL_SERVER_ERROR: java.lang.IllegalStateException: An error has been encountered at the end of expression 'resumedata.getSummary()]>'. Can not resolve method 'getSummary' on type 'class com.mycompany.service.ResumeData'.
Upvotes: -1
Views: 231
Reputation: 95
For information, I have resolved my problem. I was using
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>22.11</version>
the version was buggy. I upgraded to version 24.4 and everything works perfectly.
<version>24.4</version>
Upvotes: 0
Reputation: 1960
Data members should be public
. You should modify your class like this:
public class ResumeData {
public String firstname;
public String lastname;
public String summary;
public List<UserLanguage> userLanguage;
}
And use the following syntax in the template:
<<[resumedata.summary]>>
Upvotes: 2