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;
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations