@@ -22,8 +22,16 @@ public final class DocumentGenerationService {
2222
2323 public static final String SALARY = "Salary" ;
2424
25+ public static final String BONUS = "Bonus" ;
26+
2527 public static final String START_DATE = "Start_Date" ;
2628
29+ public static final String COMPENSATION_PACKAGE = "Compensation_Package" ;
30+
31+ public static final String COMPENSATION_COMPONENT = "Compensation_Component" ;
32+
33+ public static final String DETAILS = "Details" ;
34+
2735 public static final String TEXT_BOX = "TextBox" ;
2836
2937 public static final String STRING_TRUE = "true" ;
@@ -34,7 +42,7 @@ public final class DocumentGenerationService {
3442
3543 //ds-snippet-start:eSign42Step3
3644 private static EnvelopeDefinition addDocumentTemplate (String offerDocDocx ) throws IOException {
37- String documentName = "OfferLetterDemo .docx" ;
45+ String documentName = "OfferLetterDynamicTable .docx" ;
3846 Document document = EnvelopeHelpers .createDocumentFromFile (offerDocDocx , documentName , DEFAULT_ID );
3947 document .setOrder ("1" );
4048 document .pages ("1" );
@@ -164,21 +172,41 @@ private DocGenFormFieldRequest getFormFields(
164172 jobTitleField .setName (JOB_TITLE );
165173 jobTitleField .setValue (jobTitle );
166174
167- DocGenFormField salaryField = new DocGenFormField ();
168- salaryField .setName (SALARY );
169- salaryField .setValue (salary );
170-
171175 DocGenFormField startDateField = new DocGenFormField ();
172176 startDateField .setName (START_DATE );
173177 startDateField .setValue (startDate );
174178
179+ DocGenFormField compensationPackageField = new DocGenFormField ();
180+ compensationPackageField .setName (COMPENSATION_PACKAGE );
181+ compensationPackageField .setType ("TableRow" );
182+ compensationPackageField .setRowValues (Arrays .asList (
183+ new DocGenFormFieldRowValue ()
184+ .docGenFormFieldList (Arrays .asList (
185+ new DocGenFormField ()
186+ .name (COMPENSATION_COMPONENT )
187+ .value (SALARY ),
188+ new DocGenFormField ()
189+ .name (DETAILS )
190+ .value (salary )
191+ )),
192+ new DocGenFormFieldRowValue ()
193+ .docGenFormFieldList (Arrays .asList (
194+ new DocGenFormField ()
195+ .name (COMPENSATION_COMPONENT )
196+ .value (BONUS ),
197+ new DocGenFormField ()
198+ .name (DETAILS )
199+ .value ("You will be eligible for a bonus of up to 20 percent based on your performance." )
200+ ))
201+ ));
202+
175203 DocGenFormFields formFields = new DocGenFormFields ();
176204 formFields .setDocGenFormFieldList (Arrays .asList (
177205 candidateNameField ,
178206 managerNameField ,
179207 jobTitleField ,
180- salaryField ,
181- startDateField ));
208+ startDateField ,
209+ compensationPackageField ));
182210 formFields .setDocumentId (documentId );
183211
184212 DocGenFormFieldRequest docGenFormFieldRequest = new DocGenFormFieldRequest ();
0 commit comments