Search in sources :

Example 16 with Row

use of org.apache.poi.ss.usermodel.Row in project poi by apache.

the class ImageUtils method getRowHeightInPixels.

public static double getRowHeightInPixels(Sheet sheet, int rowNum) {
    Row r = sheet.getRow(rowNum);
    double points = (r == null) ? sheet.getDefaultRowHeightInPoints() : r.getHeightInPoints();
    return Units.toEMU(points) / (double) EMU_PER_PIXEL;
}
Also used : Row(org.apache.poi.ss.usermodel.Row)

Example 17 with Row

use of org.apache.poi.ss.usermodel.Row in project poi by apache.

the class RegionUtil method setTopBorderColor.

/**
     * Sets the top border color for a region of cells by manipulating the cell style of the individual
     * cells on the top
     * 
     * @param color The color of the border
     * @param region The region that should have the border
     * @param sheet The sheet that the region is on.
     * @since POI 3.15 beta 2
     */
public static void setTopBorderColor(int color, CellRangeAddress region, Sheet sheet) {
    int colStart = region.getFirstColumn();
    int colEnd = region.getLastColumn();
    int rowIndex = region.getFirstRow();
    CellPropertySetter cps = new CellPropertySetter(CellUtil.TOP_BORDER_COLOR, color);
    Row row = CellUtil.getRow(rowIndex, sheet);
    for (int i = colStart; i <= colEnd; i++) {
        cps.setProperty(row, i);
    }
}
Also used : Row(org.apache.poi.ss.usermodel.Row)

Example 18 with Row

use of org.apache.poi.ss.usermodel.Row in project poi by apache.

the class RegionUtil method setBottomBorderColor.

/**
     * Sets the bottom border color for a region of cells by manipulating the cell style of the individual
     * cells on the bottom
     * 
     * @param color The color of the border
     * @param region The region that should have the border
     * @param sheet The sheet that the region is on.
     * @since POI 3.15 beta 2
     */
public static void setBottomBorderColor(int color, CellRangeAddress region, Sheet sheet) {
    int colStart = region.getFirstColumn();
    int colEnd = region.getLastColumn();
    int rowIndex = region.getLastRow();
    CellPropertySetter cps = new CellPropertySetter(CellUtil.BOTTOM_BORDER_COLOR, color);
    Row row = CellUtil.getRow(rowIndex, sheet);
    for (int i = colStart; i <= colEnd; i++) {
        cps.setProperty(row, i);
    }
}
Also used : Row(org.apache.poi.ss.usermodel.Row)

Example 19 with Row

use of org.apache.poi.ss.usermodel.Row in project poi by apache.

the class RegionUtil method setBorderBottom.

/**
     * Sets the bottom border style for a region of cells by manipulating the cell style of the individual
     * cells on the bottom
     * 
     * @param border The new border
     * @param region The region that should have the border
     * @param sheet The sheet that the region is on.
     * @since POI 3.15 beta 2
     * @deprecated POI 3.16 beta 1. Use {@link #setBorderBottom(BorderStyle, CellRangeAddress, Sheet)}.
     */
@Removal(version = "3.18")
public static void setBorderBottom(int border, CellRangeAddress region, Sheet sheet) {
    int colStart = region.getFirstColumn();
    int colEnd = region.getLastColumn();
    int rowIndex = region.getLastRow();
    CellPropertySetter cps = new CellPropertySetter(CellUtil.BORDER_BOTTOM, border);
    Row row = CellUtil.getRow(rowIndex, sheet);
    for (int i = colStart; i <= colEnd; i++) {
        cps.setProperty(row, i);
    }
}
Also used : Row(org.apache.poi.ss.usermodel.Row) Removal(org.apache.poi.util.Removal)

Example 20 with Row

use of org.apache.poi.ss.usermodel.Row in project poi by apache.

the class RegionUtil method setBorderTop.

/**
     * Sets the top border style for a region of cells by manipulating the cell style of the individual
     * cells on the top
     * 
     * @param border The new border
     * @param region The region that should have the border
     * @param sheet The sheet that the region is on.
     * @since POI 3.16 beta 1
     */
public static void setBorderTop(BorderStyle border, CellRangeAddress region, Sheet sheet) {
    int colStart = region.getFirstColumn();
    int colEnd = region.getLastColumn();
    int rowIndex = region.getFirstRow();
    CellPropertySetter cps = new CellPropertySetter(CellUtil.BORDER_TOP, border);
    Row row = CellUtil.getRow(rowIndex, sheet);
    for (int i = colStart; i <= colEnd; i++) {
        cps.setProperty(row, i);
    }
}
Also used : Row(org.apache.poi.ss.usermodel.Row)

Aggregations

Row (org.apache.poi.ss.usermodel.Row)289 Cell (org.apache.poi.ss.usermodel.Cell)218 Sheet (org.apache.poi.ss.usermodel.Sheet)174 Workbook (org.apache.poi.ss.usermodel.Workbook)122 Test (org.junit.Test)112 HSSFWorkbook (org.apache.poi.hssf.usermodel.HSSFWorkbook)55 XSSFWorkbook (org.apache.poi.xssf.usermodel.XSSFWorkbook)39 CellRangeAddress (org.apache.poi.ss.util.CellRangeAddress)33 CellStyle (org.apache.poi.ss.usermodel.CellStyle)27 CellReference (org.apache.poi.ss.util.CellReference)22 FileOutputStream (java.io.FileOutputStream)19 ArrayList (java.util.ArrayList)19 XSSFColor (org.apache.poi.xssf.usermodel.XSSFColor)17 XSSFFont (org.apache.poi.xssf.usermodel.XSSFFont)17 HashMap (java.util.HashMap)16 RichTextString (org.apache.poi.ss.usermodel.RichTextString)16 XSSFCellStyle (org.apache.poi.xssf.usermodel.XSSFCellStyle)16 IOException (java.io.IOException)14 List (java.util.List)13 FormulaEvaluator (org.apache.poi.ss.usermodel.FormulaEvaluator)13