Beispiel #1
0
        /**
         * Sets the left border for a region of cells by manipulating the cell style of the individual
         * cells on the left
         *
         * @param border The new border
         * @param region The region that should have the border
         * @param workbook The workbook that the region is on.
         * @param sheet The sheet that the region is on.
         */
        public static void SetBorderLeft(int border, CellRangeAddress region, ISheet sheet,
                                         IWorkbook workbook)
        {
            int rowStart = region.FirstRow;
            int rowEnd   = region.LastRow;
            int column   = region.FirstColumn;

            CellPropertySetter cps = new CellPropertySetter(workbook, CellUtil.BORDER_LEFT, border);

            for (int i = rowStart; i <= rowEnd; i++)
            {
                cps.SetProperty(CellUtil.GetRow(i, sheet), column);
            }
        }
Beispiel #2
0
        /**
         * Sets the topBorderColor attribute of the RegionUtil object
         *
         * @param color The color of the border
         * @param region The region that should have the border
         * @param workbook The workbook that the region is on.
         * @param sheet The sheet that the region is on.
         */
        public static void SetTopBorderColor(int color, CellRangeAddress region, ISheet sheet,
                                             IWorkbook workbook)
        {
            int colStart           = region.FirstColumn;
            int colEnd             = region.LastColumn;
            int rowIndex           = region.FirstRow;
            CellPropertySetter cps = new CellPropertySetter(workbook, CellUtil.TOP_BORDER_COLOR, color);
            IRow row = CellUtil.GetRow(rowIndex, sheet);

            for (int i = colStart; i <= colEnd; i++)
            {
                cps.SetProperty(row, i);
            }
        }