Populating tables with templates in xdocreport
up vote
1
down vote
favorite
I am using the following template for populating a table while using the xdocreport library
The Java code that I am using is given below:
InputStream in = GenerateStakeholderReport.class.getResourceAsStream( "StakeholderReport_Template.docx" );
IXDocReport report = XDocReportRegistry.getRegistry().loadReport( in, TemplateEngineKind.Velocity );
FieldsMetadata metadata = report.createFieldsMetadata();
metadata.load( "stakeholders", StakeHolder.class, true );
IContext context = report.createContext();
Project project = new Project( "Project 1", "A project for Oragisational Change",
"System Implementation", "Bob Yardley","Peter");
context.put( "project", project );
List<StakeHolder> stakeholders = new ArrayList<StakeHolder>();
stakeholders.add( new StakeHolder( "01", "External", "President", "Head Quarter", "High", "5000", "Key Infulencer" ) );
stakeholders.add( new StakeHolder( "02", "Internal", "CEO", "Head Quarter", "High", "2500", "Key Infulencer" ) );
context.put( "stakeholders", stakeholders );
OutputStream out = new FileOutputStream( new File( "StakeHolderReport_Out.docx" ) );
report.process( context, out );
The output that I am getting is not what I expected; the table rows are are not populated (there should have been 2 rows). Also, two of the column headings are not getting displayed
What am I doing wrong?
java docx xdocreport
add a comment |
up vote
1
down vote
favorite
I am using the following template for populating a table while using the xdocreport library
The Java code that I am using is given below:
InputStream in = GenerateStakeholderReport.class.getResourceAsStream( "StakeholderReport_Template.docx" );
IXDocReport report = XDocReportRegistry.getRegistry().loadReport( in, TemplateEngineKind.Velocity );
FieldsMetadata metadata = report.createFieldsMetadata();
metadata.load( "stakeholders", StakeHolder.class, true );
IContext context = report.createContext();
Project project = new Project( "Project 1", "A project for Oragisational Change",
"System Implementation", "Bob Yardley","Peter");
context.put( "project", project );
List<StakeHolder> stakeholders = new ArrayList<StakeHolder>();
stakeholders.add( new StakeHolder( "01", "External", "President", "Head Quarter", "High", "5000", "Key Infulencer" ) );
stakeholders.add( new StakeHolder( "02", "Internal", "CEO", "Head Quarter", "High", "2500", "Key Infulencer" ) );
context.put( "stakeholders", stakeholders );
OutputStream out = new FileOutputStream( new File( "StakeHolderReport_Out.docx" ) );
report.process( context, out );
The output that I am getting is not what I expected; the table rows are are not populated (there should have been 2 rows). Also, two of the column headings are not getting displayed
What am I doing wrong?
java docx xdocreport
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am using the following template for populating a table while using the xdocreport library
The Java code that I am using is given below:
InputStream in = GenerateStakeholderReport.class.getResourceAsStream( "StakeholderReport_Template.docx" );
IXDocReport report = XDocReportRegistry.getRegistry().loadReport( in, TemplateEngineKind.Velocity );
FieldsMetadata metadata = report.createFieldsMetadata();
metadata.load( "stakeholders", StakeHolder.class, true );
IContext context = report.createContext();
Project project = new Project( "Project 1", "A project for Oragisational Change",
"System Implementation", "Bob Yardley","Peter");
context.put( "project", project );
List<StakeHolder> stakeholders = new ArrayList<StakeHolder>();
stakeholders.add( new StakeHolder( "01", "External", "President", "Head Quarter", "High", "5000", "Key Infulencer" ) );
stakeholders.add( new StakeHolder( "02", "Internal", "CEO", "Head Quarter", "High", "2500", "Key Infulencer" ) );
context.put( "stakeholders", stakeholders );
OutputStream out = new FileOutputStream( new File( "StakeHolderReport_Out.docx" ) );
report.process( context, out );
The output that I am getting is not what I expected; the table rows are are not populated (there should have been 2 rows). Also, two of the column headings are not getting displayed
What am I doing wrong?
java docx xdocreport
I am using the following template for populating a table while using the xdocreport library
The Java code that I am using is given below:
InputStream in = GenerateStakeholderReport.class.getResourceAsStream( "StakeholderReport_Template.docx" );
IXDocReport report = XDocReportRegistry.getRegistry().loadReport( in, TemplateEngineKind.Velocity );
FieldsMetadata metadata = report.createFieldsMetadata();
metadata.load( "stakeholders", StakeHolder.class, true );
IContext context = report.createContext();
Project project = new Project( "Project 1", "A project for Oragisational Change",
"System Implementation", "Bob Yardley","Peter");
context.put( "project", project );
List<StakeHolder> stakeholders = new ArrayList<StakeHolder>();
stakeholders.add( new StakeHolder( "01", "External", "President", "Head Quarter", "High", "5000", "Key Infulencer" ) );
stakeholders.add( new StakeHolder( "02", "Internal", "CEO", "Head Quarter", "High", "2500", "Key Infulencer" ) );
context.put( "stakeholders", stakeholders );
OutputStream out = new FileOutputStream( new File( "StakeHolderReport_Out.docx" ) );
report.process( context, out );
The output that I am getting is not what I expected; the table rows are are not populated (there should have been 2 rows). Also, two of the column headings are not getting displayed
What am I doing wrong?
java docx xdocreport
java docx xdocreport
asked Nov 10 at 17:55
Diptendu Dutta
81116
81116
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53241829%2fpopulating-tables-with-templates-in-xdocreport%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown