I have to fill a word template throught my java application. I use docx4j to manipulate the word template. It looks like that :
And I would like to add column to the center table. I succeed to fill the template, to add rows but I do not know how to add column. I searched for hours but I only found how to add rows... Here's the result I want :
This is how I add rows :
- Code: Select all
private void replaceZones(Bill bill, WordprocessingMLPackage p) throws Docx4JException, JAXBException {
BigDecimal total = BigDecimal.ZERO;
Set<Zone> zones = zoneRepository.findAllByCompany(bill.getCompany());
List<Map<String, String>> listZones = new ArrayList<>();
for (Zone zone : zones) {
Map<String, String> lineZone = new HashMap<String, String>();
lineZone.put(ZONE_TAG, zone.getName());
lineZone.put(ZONE_TOTAL_TAG, computeTotalZone(bill, zone, total) + " €");
listZones.add(lineZone);
}
Map<String, String> lineBlank = new HashMap<String, String>();
lineBlank.put(ZONE_TAG, "");
lineBlank.put(ZONE_TOTAL_TAG, "");
listZones.add(lineBlank);
replaceTable(new String[] { ZONE_TAG, ZONE_TOTAL_TAG }, listZones, p, 2);
}
Thanks !