From 23503c25f52fb04d83f919ae55d65ca11078cce2 Mon Sep 17 00:00:00 2001 From: Dharani Thangarasu Date: Mon, 30 Aug 2021 19:21:24 +0530 Subject: [PATCH 1/2] Addressed the feedback --- dynamictable/DynamicTable.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dynamictable/DynamicTable.java b/dynamictable/DynamicTable.java index cf450e4..7b00cf0 100644 --- a/dynamictable/DynamicTable.java +++ b/dynamictable/DynamicTable.java @@ -12,24 +12,22 @@ public static void main(String[] args) throws Exception { // Creates a list of employee details. ListSupport employeeDetails = getEmployeeDetails(); // Iterates each item in the list. - for (Object employee_tempObj : employeeDetails) + for (Employees employee : employeeDetails) { - Employees employee = (Employees) employee_tempObj; // Accesses the table in the document. IWTable table = document.getSections().get(0).getTables().get(0); - // Initializes the paragraph. + // Initializes the paragraph and add new row to the table IWParagraph paragraph = null; - // Initializes and add new row to the table. WTableRow newRow = null; newRow = table.addRow(); // Gets the employee photo and convert that base64 string to bytes. byte[] bytes = ConvertSupport.fromBase64String(employee.getPhoto()); ByteArrayInputStream stream = new ByteArrayInputStream(bytes); - int i = table.getRows().getCount(); + int index = table.getRows().getCount(); // Appends the picture to the first cell. - table.getRows().get(i - 1).getCells().get(0).addParagraph().appendPicture(stream); + table.getRows().get(index - 1).getCells().get(0).addParagraph().appendPicture(stream); // Appends the employee details in the second cell. - paragraph = table.getRows().get(i - 1).getCells().get(1).addParagraph(); + paragraph = table.getRows().get(index - 1).getCells().get(1).addParagraph(); paragraph.appendText(employee.getName() + "\n" + employee.getTitle() + "\n" + employee.getAddress() + "\n" + employee.getHomePhone()); } From fc63db38ffdc541c1ebc84e4e513906709f715e7 Mon Sep 17 00:00:00 2001 From: Dharani Thangarasu Date: Mon, 30 Aug 2021 19:22:34 +0530 Subject: [PATCH 2/2] Modified xml comments --- dynamictable/DynamicTable.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dynamictable/DynamicTable.java b/dynamictable/DynamicTable.java index 7b00cf0..79df787 100644 --- a/dynamictable/DynamicTable.java +++ b/dynamictable/DynamicTable.java @@ -16,7 +16,7 @@ public static void main(String[] args) throws Exception { { // Accesses the table in the document. IWTable table = document.getSections().get(0).getTables().get(0); - // Initializes the paragraph and add new row to the table + // Initializes the paragraph and add new row to the table. IWParagraph paragraph = null; WTableRow newRow = null; newRow = table.addRow();