Ejemplo n.º 1
0
 public override IList <Border> GetVerticalBorder(int index)
 {
     if (index == 0)
     {
         IList <Border> borderList = TableBorderUtil.CreateAndFillBorderList(null, tableBoundingBorders[3], verticalBorders
                                                                             [0].Count);
         return(GetCollapsedList(verticalBorders[0], borderList));
     }
     else
     {
         if (index == numberOfColumns)
         {
             IList <Border> borderList = TableBorderUtil.CreateAndFillBorderList(null, tableBoundingBorders[1], verticalBorders
                                                                                 [0].Count);
             return(GetCollapsedList(verticalBorders[verticalBorders.Count - 1], borderList));
         }
         else
         {
             return(verticalBorders[index]);
         }
     }
 }
Ejemplo n.º 2
0
 public override IList <Border> GetHorizontalBorder(int index)
 {
     if (index == startRow)
     {
         IList <Border> firstBorderOnCurrentPage = TableBorderUtil.CreateAndFillBorderList(topBorderCollapseWith, tableBoundingBorders
                                                                                           [0], numberOfColumns);
         if (index == largeTableIndexOffset)
         {
             return(GetCollapsedList(horizontalBorders[index - largeTableIndexOffset], firstBorderOnCurrentPage));
         }
         if (0 != rows.Count)
         {
             int col = 0;
             int row = index;
             while (col < numberOfColumns)
             {
                 if (null != rows[row - largeTableIndexOffset][col] && row - index + 1 <= (int)((Cell)rows[row - largeTableIndexOffset
                                                                                                ][col].GetModelElement()).GetRowspan())
                 {
                     CellRenderer cell = rows[row - largeTableIndexOffset][col];
                     Border       cellModelTopBorder = TableBorderUtil.GetCellSideBorder(((Cell)cell.GetModelElement()), Property.BORDER_TOP
                                                                                         );
                     int colspan = (int)cell.GetPropertyAsInteger(Property.COLSPAN);
                     if (null == firstBorderOnCurrentPage[col] || (null != cellModelTopBorder && cellModelTopBorder.GetWidth()
                                                                   > firstBorderOnCurrentPage[col].GetWidth()))
                     {
                         for (int i = col; i < col + colspan; i++)
                         {
                             firstBorderOnCurrentPage[i] = cellModelTopBorder;
                         }
                     }
                     col += colspan;
                     row  = index;
                 }
                 else
                 {
                     row++;
                     if (row == rows.Count)
                     {
                         break;
                     }
                 }
             }
         }
         return(firstBorderOnCurrentPage);
     }
     else
     {
         if ((index == finishRow + 1))
         {
             IList <Border> lastBorderOnCurrentPage = TableBorderUtil.CreateAndFillBorderList(bottomBorderCollapseWith,
                                                                                              tableBoundingBorders[2], numberOfColumns);
             if (index - largeTableIndexOffset == horizontalBorders.Count - 1)
             {
                 return(GetCollapsedList(horizontalBorders[index - largeTableIndexOffset], lastBorderOnCurrentPage));
             }
             if (0 != rows.Count)
             {
                 int col = 0;
                 int row = index - 1;
                 while (col < numberOfColumns)
                 {
                     // TODO
                     if (null != rows[row - largeTableIndexOffset][col])
                     {
                         CellRenderer cell = rows[row - largeTableIndexOffset][col];
                         Border       cellModelBottomBorder = TableBorderUtil.GetCellSideBorder(((Cell)cell.GetModelElement()), Property.
                                                                                                BORDER_BOTTOM);
                         int colspan = (int)cell.GetPropertyAsInteger(Property.COLSPAN);
                         if (null == lastBorderOnCurrentPage[col] || (null != cellModelBottomBorder && cellModelBottomBorder.GetWidth
                                                                          () > lastBorderOnCurrentPage[col].GetWidth()))
                         {
                             for (int i = col; i < col + colspan; i++)
                             {
                                 lastBorderOnCurrentPage[i] = cellModelBottomBorder;
                             }
                         }
                         col += colspan;
                         row  = index - 1;
                     }
                     else
                     {
                         row++;
                         if (row == rows.Count)
                         {
                             break;
                         }
                     }
                 }
             }
             return(lastBorderOnCurrentPage);
         }
         else
         {
             return(horizontalBorders[index - largeTableIndexOffset]);
         }
     }
 }