예제 #1
0
 internal void calculateHeights()
 {
     if (totalWidth <= 0)
     {
         return;
     }
     totalHeight = 0;
     for (int k = 0; k < rows.Count; ++k)
     {
         PdfPRow row = (PdfPRow)rows[k];
         row.setWidths(absoluteWidths);
         totalHeight += row.MaxHeights;
     }
 }
예제 #2
0
        /** Adds a cell element.
         * @param cell the cell element
         */
        public void addCell(PdfPCell cell)
        {
            PdfPCell ncell   = new PdfPCell(cell);
            int      colspan = ncell.Colspan;

            colspan       = Math.Max(colspan, 1);
            colspan       = Math.Min(colspan, currentRow.Length - currentRowIdx);
            ncell.Colspan = colspan;
            if (colspan != 1)
            {
                isColspan = true;
            }
            int rdir = ncell.RunDirection;

            if (rdir == PdfWriter.RUN_DIRECTION_DEFAULT)
            {
                ncell.RunDirection = runDirection;
            }
            currentRow[currentRowIdx] = ncell;
            currentRowIdx            += colspan;
            if (currentRowIdx >= currentRow.Length)
            {
                if (runDirection == PdfWriter.RUN_DIRECTION_RTL)
                {
                    PdfPCell[] rtlRow = new PdfPCell[absoluteWidths.Length];
                    int        rev    = currentRow.Length;
                    for (int k = 0; k < currentRow.Length; ++k)
                    {
                        PdfPCell rcell = currentRow[k];
                        int      cspan = rcell.Colspan;
                        rev        -= cspan;
                        rtlRow[rev] = rcell;
                        k          += cspan - 1;
                    }
                    currentRow = rtlRow;
                }
                PdfPRow row = new PdfPRow(currentRow);
                if (totalWidth > 0)
                {
                    row.setWidths(absoluteWidths);
                    totalHeight += row.MaxHeights;
                }
                rows.Add(row);
                currentRow    = new PdfPCell[absoluteWidths.Length];
                currentRowIdx = 0;
            }
        }