I am creating a pdf page using the table structures for pdf. When I enter large amounts of text in the cell, the word wrapping does not always break at white space. As you can see in the example there are several words that get split in the middle at the end of a line. Here is the section of code that is creating the table:
// Begin Work Experience Section
if (f.isExperience()) {
//get the employee's experiences
List experienceList = experienceBO.getActiveExperiences(candidate.getUidKey());
String categoryLabel1, categoryLabel2, categoryLabel3, categoryLabel4;
String experienceLevel04 = "";
if (experienceList != null && experienceList.size() > 0) {
Table experienceTable = new Table();
experienceTable.getDefaultCellPadding().setLeft(1);
experienceTable.getDefaultCellPadding().setRight(1);
experienceTable.getDefaultCellPadding().setTop(1);
experienceTable.getDefaultCellPadding().setBottom(1);
sec1.getParagraphs().add(new Text("",dataTI));
sec1.getParagraphs().add(experienceTable);
experienceTable.setColumnWidths("20% 30% 20% 30%");
for (int i=0;i<experienceList.size();i++) {
ExperienceEntity current = experienceList.get(i);
String title = "";
if (i == 0) {
title = "Current Assignment";
} else {
title = "Previous Assignment " + i;
}
experienceLevel04 = current.getLevel04Id();
categoryLabel1 = getCategoryLabel(request,experienceLevel04,"1") + ":";
categoryLabel2 = getCategoryLabel(request,experienceLevel04,"2") + ":";
categoryLabel3 = getCategoryLabel(request,experienceLevel04,"3") + ":";
categoryLabel4 = getCategoryLabel(request,experienceLevel04,"4") + ":";
row = experienceTable.getRows().add();
titleCell = row.getCells().add(title, titleTI);
titleCell.setColumnsSpan(4);
titleCell.setBackgroundColor(tableHeaderBackground);
titleCell.setVerticalAlignment(VerticalAlignmentType.Center);
titleCell.getPadding().setTop(2);
row = experienceTable.getRows().add();
labelCell = row.getCells().add("Level 04:", labelTI);
labelCell.setAlignment(AlignmentType.Right);
labelCell.getPadding().setTop(2);
dataCell = row.getCells().add(current.getLevel04().getDescription(), dataTI);
dataCell.getPadding().setTop(2);
labelCell = row.getCells().add("Date of Position:", labelTI);
labelCell.setAlignment(AlignmentType.Right);
labelCell.getPadding().setTop(2);
dataCell = row.getCells().add(current.getFromDateDisplay() + " to " + current.getToDateDisplay(), dataTI);
dataCell.getPadding().setTop(2);
row = experienceTable.getRows().add();
labelCell = row.getCells().add("Product Line:", labelTI);
labelCell.setAlignment(AlignmentType.Right);
dataCell = row.getCells().add(current.getProductLine().getName(), dataTI);
labelCell = row.getCells().add(categoryLabel1, labelTI);
labelCell.setAlignment(AlignmentType.Right);
dataCell = row.getCells().add(current.getRole().getName(), dataTI);
row = experienceTable.getRows().add();
labelCell = row.getCells().add("Program:", labelTI);
labelCell.setAlignment(AlignmentType.Right);
dataCell = row.getCells().add(current.getProgram().getName(), dataTI);
labelCell = row.getCells().add("Job Title:", labelTI);
labelCell.setAlignment(AlignmentType.Right);
dataCell = row.getCells().add(current.getJobTitle(), dataTI);
row = experienceTable.getRows().add();
labelCell = row.getCells().add(categoryLabel2, labelTI);
labelCell.setAlignment(AlignmentType.Right);
dataCell = row.getCells().add(current.getIntegrationLevel().getName(), dataTI);
labelCell = row.getCells().add("Manager:", labelTI);
labelCell.setAlignment(AlignmentType.Right);
dataCell = row.getCells().add(current.getPositionManager(), dataTI);
row = experienceTable.getRows().add();
labelCell = row.getCells().add(categoryLabel4, labelTI);
labelCell.setAlignment(AlignmentType.Right);
dataCell = row.getCells().add(current.getContractValue().getName(), dataTI);
if (certificationLevel05List != null) {
labelCell = row.getCells().add("Associated Certifications", labelTI);
labelCell.setAlignment(AlignmentType.Right);
dataCell = row.getCells().add(current.getAssociatedLevel05ReportDisplay(), dataTI);
} else {
labelCell = row.getCells().add("", labelTI);
dataCell = row.getCells().add("", dataTI);
}
row = experienceTable.getRows().add();
labelCell = row.getCells().add(categoryLabel3, labelTI);
labelCell.setAlignment(AlignmentType.Right);
StringBuilder customerBuilder = new StringBuilder();
for (CustomerEntity currentCustomer : current.getActiveCustomers()) {
if (!customerBuilder.toString().equals("")) {
customerBuilder.append("; ");
}
customerBuilder.append(currentCustomer.getName());
}
dataCell = row.getCells().add(customerBuilder.toString(), dataTI);
dataCell.setColumnsSpan(3);
row = experienceTable.getRows().add();
labelCell = row.getCells().add("Job Description:", labelTI);
labelCell.setAlignment(AlignmentType.Right);
dataCell = row.getCells().add(current.getPositionDetails(), dataTI);
dataCell.setColumnsSpan(3);
row = experienceTable.getRows().add();
labelCell = row.getCells().add("Describe Experience:", labelTI);
labelCell.setAlignment(AlignmentType.Right);
dataCell = row.getCells().add(current.getDescription(), dataTI);
dataCell.setColumnsSpan(3);
}
}
// End Work Experience Section
Is there a word wrap setting that I am missing?
Thank you for your time.