|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
Confusing Cell Hight numbers.Hi all, I have attached the PDF as a reference for what I am doing. The situation is this... The first time it creates the first quantity line I get a row height calculated at either 1404 or 1794 depending on the document that is fed into the program.. They all have the same thing in line one.. Exactly the same thing.. This never changes. Yet when I calculate the height of the next rows I get 64 continuously which is the correct answer.. Here is the code to create the line information.. float[] widths3 = {0.5f, 6.0f, 1.0f, 1.0f}; doutTable = new PdfPTable(widths3); doutTable.setWidthPercentage(100); doutTable.setTotalWidth(24.0f); doutTable.deleteBodyRows(); for (int nxt = 0; nxt < 100; nxt++) { if (sqQDL[nxt].compareTo("")>0) { if (sqQQL[nxt].equals("0")) { outLine = ""; } else { outLine = sqQQL[nxt]; } if (sqQST[nxt].equals("Yes")) { outPara = new Paragraph(outLine, FontFactory.getFont(FontFactory.HELVETICA, 10, Font.BOLD)); } else { outPara = new Paragraph(outLine, FontFactory.getFont(FontFactory.HELVETICA, 10)); } print("Counter = " + nxt + " / OutLine = " + outLine); cell = new PdfPCell(new Paragraph(outPara)); cell.setBorder(Rectangle.LEFT); cell.setHorizontalAlignment(Element.ALIGN_CENTER); doutTable.addCell(cell); cellHeight = doutTable.getRowHeight(0); print("Counter = " + nxt + " = " + cellHeight + " / tot = " + totHeight); outLine = sqQDL[nxt]; if (sqQST[nxt].equals("Yes")) { outPara = new Paragraph(outLine, FontFactory.getFont(FontFactory.HELVETICA, 10, Font.BOLD)); } else { outPara = new Paragraph(outLine, FontFactory.getFont(FontFactory.HELVETICA, 10)); } print("Counter = " + nxt + " / OutLine = " + outLine); cell = new PdfPCell(new Paragraph(outPara)); cell.setBorder(Rectangle.LEFT); cell.setHorizontalAlignment(Element.ALIGN_LEFT); doutTable.addCell(cell); cellHeight = doutTable.getRowHeight(0); print("Counter = " + nxt + " = " + cellHeight + " / tot = " + totHeight); if (sqQUL[nxt].equals("0.00")) { outLine = ""; } else { outLine = sqQUL[nxt]; } if (sqQST[nxt].equals("Yes")) { outPara = new Paragraph(outLine, FontFactory.getFont(FontFactory.HELVETICA, 10, Font.BOLD)); } else { outPara = new Paragraph(outLine, FontFactory.getFont(FontFactory.HELVETICA, 10)); } print("Counter = " + nxt + " / OutLine = " + outLine); cell = new PdfPCell(new Paragraph(outPara)); cell.setBorder(Rectangle.LEFT); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); doutTable.addCell(cell); cellHeight = doutTable.getRowHeight(0); print("Counter = " + nxt + " = " + cellHeight + " / tot = " + totHeight); if (sqQTL[nxt].equals("0.00")) { outLine = ""; } else { outLine = sqQTL[nxt]; } if (sqQST[nxt].equals("Yes")) { outPara = new Paragraph(outLine, FontFactory.getFont(FontFactory.HELVETICA, 10, Font.BOLD)); } else { outPara = new Paragraph(outLine, FontFactory.getFont(FontFactory.HELVETICA, 10)); } print("Counter = " + nxt + " / OutLine = " + outLine); cell = new PdfPCell(new Paragraph(outPara)); cell.setBorder(Rectangle.LEFT | Rectangle.RIGHT); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); doutTable.addCell(cell); cellHeight = doutTable.getRowHeight(0); totHeight = totHeight + cellHeight; print("Counter = " + nxt + " = " + cellHeight + " / tot = " + totHeight); if (totHeight > 1050.0) { // trailer(); print("************* Total Height = " +totHeight); totHeight = 636.0f; // This is what the header part would calculate to.. // header(); pageNum++; } pdfDoc.add(doutTable); doutTable.deleteBodyRows(); } } Glen Hamel Lead Programmer / Technician Auric Networks Canada, Inc. 570 Orwell Street, Unit 1 Mississauga, Ontario L5A 3V7 Phone 905.361.7621 Fax 905.274.3912 http://www.auricnet.ca |
| Free Forum Powered by Nabble | Forum Help |