/** * Writes the selected rows to the document. * <P> * <CODE>canvases</CODE> is obtained from <CODE>beginWrittingRows()</CODE>. * @param rowStart the first row to be written, zero index * @param rowEnd the last row to be written - 1. If it is -1 all the * rows to the end are written * @param xPos the x write coodinate * @param yPos the y write coodinate * @param canvases an array of 4 <CODE>PdfContentByte</CODE> obtained from * <CODE>beginWrittingRows()</CODE> * @return the y coordinate position of the bottom of the last row * @see #beginWritingRows(iTextSharp.text.pdf.PdfContentByte) */ public float writeSelectedRows(int rowStart, int rowEnd, float xPos, float yPos, PdfContentByte[] canvases) { if (totalWidth <= 0) { throw new RuntimeException("The table width must be greater than zero."); } int size = rows.Count; if (rowEnd < 0) { rowEnd = size; } if (rowStart >= size || rowStart >= rowEnd) { return(yPos); } rowEnd = Math.Min(rowEnd, size); float yPosStart = yPos; for (int k = rowStart; k < rowEnd; ++k) { PdfPRow row = (PdfPRow)rows[k]; row.writeCells(xPos, yPos, canvases); yPos -= row.MaxHeights; } if (tableEvent != null) { float[] heights = new float[rowEnd - rowStart + 1]; heights[0] = yPosStart; for (int k = rowStart; k < rowEnd; ++k) { PdfPRow row = (PdfPRow)rows[k]; heights[k - rowStart + 1] = heights[k - rowStart] - row.MaxHeights; } tableEvent.tableLayout(this, getEventWidths(xPos, rowStart, rowEnd, false), heights, 0, rowStart, canvases); } return(yPos); }