different borders
In this program we are going create a sheet after
that enter the values in that cell then we create different borders and we
also sets the different colors. .
Code description
The package we need to import is java.io.*,java.util.* ,org.apache.poi.hssf.usermodel.HSSFSheet,org.apache.poi.hssf.usermodel.
HSSFCell,org.apache.poi.hssf.usermodel.
HSSFCellStyle,org.apache.poi.hssf.usermodel.HSSFRow, org.apache.poi.usermodel.
HSSFColor and org.apache.poi.hssf.usermodel.
HSSFWorkbook.
We can set various borders and set various color of the borders.
The method used in this example shift row
setBorderLeft(short border):
This method is used to set the type of border to use for the left border of the cell
In this method we pass only one parameter. That is border type.
setBorderRight(short border):
This method is used to set the type of border to use for the right border of the cell
setBorderTop(short border):
This method is used to set the type of border to use for the top border of the cell
setBorderBottom(short border):
This method is used to set the type of border to use for the bottom border of the cell
setLeftBorderColor(short color):
This method is used to set the color to use for the left border
setRightBorderColor(short color):
This method is used to set the color to use for the right border
setTopBorderColor(short color):
This method is used to set the color to use for the top border
setBottomBorderColor(short color):
This method is used to set the color to use for the bottom border
We can pass following short type for border.
BORDER_NONE, BORDER_THIN, BORDER_MEDIUM, BORDER_DASHED, BORDER_DOTTED,
BORDER_THICK, BORDER_DOUBLE, BORDER_HAIR, BORDER_MEDIUM_DASHED, BORDER_DASH_DOT,
BORDER_MEDIUM_DASH_DOT, BORDER_DASH_DOT_DOT, BORDER_MEDIUM_DASH_DOT_DOT, BORDER_SLANTED_DASH_DOT
The code of the program is given below:
<%@ page import="org.apache.poi.hssf.usermodel.HSSFSheet"%>
|
The output of the program is given below: