doc.add(pData);
doc.add(Chunk.NEWLINE);
// Generates the data table
int rowNo = 5;
PdfPTable dataTableHeader = new PdfPTable(rowNo);
PdfPCell dataTblHeaderCell;
Phrase pTemp = new Phrase("NODE", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
dataTblHeaderCell = new PdfPCell(pTemp);
dataTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
dataTableHeader.addCell(dataTblHeaderCell);
pTemp = new Phrase("DEPTH"+"\n"+"(m)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
dataTblHeaderCell = new PdfPCell(pTemp);
dataTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
dataTableHeader.addCell(dataTblHeaderCell);
pTemp = new Phrase("MODULUS OF SUBGRADE REACTION"+"\n"+"(kN/m)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
dataTblHeaderCell = new PdfPCell(pTemp);
dataTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
dataTableHeader.addCell(dataTblHeaderCell);
pTemp = new Phrase("LATERAL SOIL MOVEMENTS"+"\n"+"(m)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
dataTblHeaderCell = new PdfPCell(pTemp);
dataTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
dataTableHeader.addCell(dataTblHeaderCell);
pTemp = new Phrase("LIMIT SOIL PRESSURE"+"\n"+"(kN/m²)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
dataTblHeaderCell = new PdfPCell(pTemp);
dataTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
dataTableHeader.addCell(dataTblHeaderCell);
PdfPCell dataTblCell;
PdfPTable dataTable = new PdfPTable(rowNo);
for (int i = 0; i <= data.getNumOfElements(); i++) {
Phrase pNode = new Phrase(Integer.toString(i), FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
dataTblCell = new PdfPCell(pNode);
dataTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
dataTable.addCell(dataTblCell);
Phrase pPileNodeCoord = new Phrase(Double.toString(data.getPileNodeCoordinate(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
dataTblCell = new PdfPCell(pPileNodeCoord);
dataTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
dataTable.addCell(dataTblCell);
Phrase pModOfSub = new Phrase(Double.toString(data.getModOfSubgradeReaction(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
dataTblCell = new PdfPCell(pModOfSub);
dataTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
dataTable.addCell(dataTblCell);
Phrase pLateralSoilMov = new Phrase(Double.toString(data.getLateralSoilMovement(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
dataTblCell = new PdfPCell(pLateralSoilMov);
dataTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
dataTable.addCell(dataTblCell);
Phrase pLimitSoilPress = new Phrase(Double.toString(data.getLimitSoilPressure(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
dataTblCell = new PdfPCell(pLimitSoilPress);
dataTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
dataTable.addCell(dataTblCell);
}
doc.add(dataTableHeader);
doc.add(dataTable);
doc.newPage();
// Create the title for the result table
Chunk theResultTable = new Chunk("The Result Table", new Font(Font.TIMES_ROMAN, 18, Font.BOLD));
Paragraph pResult = new Paragraph(theResultTable);
pResult.setAlignment(Element.ALIGN_CENTER);
doc.add(pResult);
doc.add(Chunk.NEWLINE);
// Generates the result table
rowNo = 9;
PdfPTable resultTableHeader = new PdfPTable(rowNo);
PdfPCell resultTblHeaderCell;
pTemp = new Phrase("NODE", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
resultTblHeaderCell = new PdfPCell(pTemp);
resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTableHeader.addCell(resultTblHeaderCell);
pTemp = new Phrase("DEPTH"+"\n"+"(m)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
resultTblHeaderCell = new PdfPCell(pTemp);
resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTableHeader.addCell(resultTblHeaderCell);
pTemp = new Phrase("SOIL MOVEMENT"+"\n"+"(mm)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
resultTblHeaderCell = new PdfPCell(pTemp);
resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTableHeader.addCell(resultTblHeaderCell);
pTemp = new Phrase("SOIL PRESSURE"+"\n"+"(kPa)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
resultTblHeaderCell = new PdfPCell(pTemp);
resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTableHeader.addCell(resultTblHeaderCell);
pTemp = new Phrase("ABS"+"\n"+"SOIL PRESSURE"+"\n"+"(kPa)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
resultTblHeaderCell = new PdfPCell(pTemp);
resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTableHeader.addCell(resultTblHeaderCell);
pTemp = new Phrase("DISPLACEMENT"+"\n"+"(mm)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
resultTblHeaderCell = new PdfPCell(pTemp);
resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTableHeader.addCell(resultTblHeaderCell);
pTemp = new Phrase("ROTATION"+"\n"+"(rad)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 7, Font.BOLD));
resultTblHeaderCell = new PdfPCell(pTemp);
resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTableHeader.addCell(resultTblHeaderCell);
pTemp = new Phrase("BENDING MOMENT"+"\n"+"(kNm)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
resultTblHeaderCell = new PdfPCell(pTemp);
resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTableHeader.addCell(resultTblHeaderCell);
pTemp = new Phrase("SHEAR FORCE"+"\n"+"(kN)", FontFactory.getFont(FontFactory.TIMES_ROMAN, 8, Font.BOLD));
resultTblHeaderCell = new PdfPCell(pTemp);
resultTblHeaderCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTableHeader.addCell(resultTblHeaderCell);
PdfPTable resultTable = new PdfPTable(rowNo);
PdfPCell resultTblCell;
for (int i = 0; i < data.getNumOfElements() + 1; i++) {
Phrase pNodes = new Phrase(Integer.toString(i), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.BOLD));
resultTblCell = new PdfPCell(pNodes);
resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTable.addCell(resultTblCell);
Phrase pPileNodeCoord = new Phrase(Double.toString(data.getPileNodeCoordinate(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
resultTblCell = new PdfPCell(pPileNodeCoord);
resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTable.addCell(resultTblCell);
Phrase pSoilMov = new Phrase(Double.toString(result.getSoilMovement(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
resultTblCell = new PdfPCell(pSoilMov);
resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTable.addCell(resultTblCell);
Phrase pSoilPress = new Phrase(Double.toString(result.getSoilPressure(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
resultTblCell = new PdfPCell(pSoilPress);
resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTable.addCell(resultTblCell);
Phrase pLimitPressure = new Phrase(Double.toString(result.getLimitPressure(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
resultTblCell = new PdfPCell(pLimitPressure);
resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTable.addCell(resultTblCell);
Phrase pDisplacement = new Phrase(Double.toString(result.getDisplacement(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
resultTblCell = new PdfPCell(pDisplacement);
resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTable.addCell(resultTblCell);
Phrase pRotation = new Phrase(Double.toString(result.getRotation(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
resultTblCell = new PdfPCell(pRotation);
resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTable.addCell(resultTblCell);
Phrase pBendingMoment = new Phrase(Double.toString(result.getBendingMoment(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
resultTblCell = new PdfPCell(pBendingMoment);
resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTable.addCell(resultTblCell);
Phrase pShearForce = new Phrase(Double.toString(result.getShearForce(i)), FontFactory.getFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL));
resultTblCell = new PdfPCell(pShearForce);
resultTblCell.setHorizontalAlignment(Element.ALIGN_CENTER);
resultTable.addCell(resultTblCell);
}
doc.add(resultTableHeader);
doc.add(resultTable);