Home Answers Viewqa Java-Magazine How to set background of an excel sheet using POI

 
 


koushil Nath
How to set background of an excel sheet using POI
1 Answer(s)      4 years and 9 months ago
Posted in : Java Magazine

View Answers

September 8, 2008 at 12:26 PM


Hi friend,


To set the background color of excel using POI:

<%@ page import="org.apache.poi.hssf.usermodel.HSSFSheet"%>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFWorkbook"%>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFRow"%>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFCell"%>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFCellStyle"%>
<%@ page import="org.apache.poi.hssf.util.HSSFColor"%>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%

try{
HSSFWorkbook hwb = new HSSFWorkbook();
HSSFSheet sheet = hwb.createSheet("new sheet");
HSSFCellStyle style = hwb.createCellStyle();
for(int j=0;j<10;j++)
{
HSSFRow row = sheet.createRow((short) +j);
HSSFCell cell=null;
for(int i=0;i<256;i++)
{
cell = row.createCell((short) +i);
cell.setCellStyle(style);
}
}

style.setFillBackgroundColor(HSSFColor.AQUA.index);
style.setFillPattern(HSSFCellStyle.BIG_SPOTS);
style.setFillForegroundColor(HSSFColor.AQUA.index);
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);

FileOutputStream fileOut = new FileOutputStream("C:\\excel\\fillsColor.xls");
hwb.write(fileOut);
fileOut.close();
out.println("Your excel file has been generated");
}
catch (Exception ex){

}
%>

For read more in details to visit....

http://www.roseindia.net/jsp/poi/index.shtml

Thanks










Related Pages:
How to set background of an excel sheet using POI - Java Magazine
How to set background of an excel sheet using POI  Hi, i am trying to format the excel using java. How to set the background color of an excel..., koushil Nath.  Hi friend, To set the background color of excel
Insert Image into Excel Sheet
Insert Image into Excel Sheet In this section, you will learn how to insert image into excel sheet using Apache POI. In the given below example, am image is insert into excel sheet at row 1 and at column 1. you can specify the top
How to read every cell of an excel sheet using Apache POI and insert those data into a DB?
How to read every cell of an excel sheet using Apache POI and insert those data into a DB?   i have an excel sheet, whose data in each cell has... the rows of an excel sheet. Need the source code
Drawing a Shape in Excel Sheet
Drawing a Shape in Excel Sheet In this section, you will learn how to draw a shape in excel sheets using Apache POI library. Using Apache POI, you can draw...; Secondly, for positioning the shape on the excel sheet , create an anchor. Use
Need to remove duplicate rows from the Excel Sheet using the Apache POI API
Need to remove duplicate rows from the Excel Sheet using the Apache POI API   Hi There, Is any one aware of java code on how to find the duplicate rows in excel.I am using the Apache POI API to achieve the same have googled
Excel Sheet Footer
Excel Sheet Footer In this section, you will learn how to create footer on a sheet using Apache POI. In the given below example, we will create footers having different position on sheet. These footers will appear on the hardcopy
Create Excel(.xlsx) document using Apache POI
Create Excel(.xlsx) document using Apache POI In this section, you will learn how to create a Excel sheet having .xlsx extension using Apache POI library. In the given below example, we will going to create excel document having one
Apache POI Excel creation - Development process
Apache POI Excel creation  Hi i am creating Excel sheet using Apache POI. i could able to generate Excel sheet and saving it in mentioned physical...; Hi friend, Code to help creating excel sheet using POI
excel sheet reading and using that data - JSP-Servlet
excel sheet reading and using that data  i have to do a read a excel sheet file of a employee record and then i have to use a employee details to send mail to those employees how to do in jsp sir please help me sir.. Thanks
Excel Sheet Header
Excel  Sheet Header In this section, you will learn how to create header on a sheet using Apache POI. In the given below example, we will create... on the hardcopy(print out) . You can see this by taking print preview of the sheet. Given
How to get data from Excel sheet - Struts
How to get data from Excel sheet  Hi, I have an excel sheet... excel sheet and display in console first then later insert this data into database. i am using java, jsp, struts also but not using struts html tags just using
Need to remove duplicated rows from excel using apache POI API
. but that excel sheet having somany duplicated rows. So can any one suggest me how to remove duplicated rows from excel sheet by using apache poi api oe jxl api...Need to remove duplicated rows from excel using apache POI API  Hi
Create Simple Excel(.xls) document using Apache POI
Create Simple Excel(.xls) document using Apache POI In this section, you will learn how to create a Simple Excel sheet having .xls extension using Apache POI library. In the given below example, we will going to create a simple excel
How to Create New Excel Sheet Using JSP
How to create new excel sheet using jsp  ... a new  excel sheet using java .You can create any number of  new excel sheets in a excel file.  To create a excel sheet we can use third party APIs
how to set background image
how to set background image  how to set image in background in that image i want over lay text how it possible in jsp? using flash image how it is overlayed in jsp page? thanks
Set Zoom Magnification of Excel Sheet
Set  Zoom Magnification of Excel Sheet In this section, you will learn how to set the zoom magnification of a Excel workbook's sheet. Zoom... for the denominator. You can set the zoom magnification of a sheet as follows : sheet1.setZoom
Read Excel(.xlsx) document using Apache POI
Read Excel(.xlsx) document using Apache POI In this section, you will learn how to read Excel file having .xlsx extension using Apache POI library. In the below example, we will read excel document having one sheet named as "new
Set Data Format in Excel Using POI 3.0
Set Data Format in Excel Using POI 3.0   ... file using Java.  POI version 3.0 provides a new feature for manipulating... of this will be 11,111.1 .To set the data format we are using setDataFormat() method
Excel Splits Pane Feature
Excel Splits Pane Feature In this section, you will learn how to split the excel sheet using Apache POI. Sometimes, you need to view more than one copy of the sheet. This can be done using Excel Splits Pane Feature. Using
reading excel sheet in java
reading excel sheet in java  can anyone tell me a proper java code to read excel sheet using poi   Here is a java code that reads an excel file using POI api and display the data on the console. import java.io.
Format Cell of Simple Excel Sheet(.xls)
Format Cell of Simple Excel  Sheet(.xls) In this section, you will how to format the cell of a simple excel sheet having extension .xls. In the below.... In the below example, i have used Apache POI version 3.7. For downloading the above
excel
excel  how to save excel sheet data into the database using poi api?   import java.io.*; import java.sql.*; import java.util.*; import java.util.regex.*; import org.apache.poi.hssf.usermodel.
Excel Created using POI and HSSF - Development process
Excel Created using POI and HSSF  Hi i ceated excel file using jakarta poi library i want to add Percentage formula to cell i am not able to do that can you please suggest me how do i add formula c3.setCellValue("Percentage
Read Simple Excel(.xls) document using Apache POI
Read Simple Excel(.xls) document using Apache POI In this section, you will learn how to read Excel file having .xls extension using Apache POI library. In the below example, we will read excel document having one sheet named as "
read data from Excel sheet
read data from Excel sheet  Hi, How to read data from an excel sheet using JSP. Thank you
Create Excel Sheet Using JSP
create excel sheet using jsp       In this example we create excel sheet and insert values into table of the excel sheet . In this example we use page directive
How to export data from jsp to excel sheet by using java
How to export data from jsp to excel sheet by using java   How to export data from jsp to excel sheet by using java
How to export data from html to excel sheet by using java
How to export data from html to excel sheet by using java   How to export data from html to excel sheet by using java
how to count no.of sheets in excel through POI jar as well as through Java?
how to count no.of sheets in excel through POI jar as well as through Java... will be dynamic ) .I want to read all sheets one by one in java by using POI jar. I am able to read one sheet at a time by using POI jar(workbook.getSheetAt(0
Filling Color in Excel Using JSP
filling color in excel using jsp   ... and four style sheet .Then we set the fill color of forground ,pattern and background color .Then at last we add the style sheet into cellls and finally we add
How to export data from html file to excel sheet by using java
How to export data from html file to excel sheet by using java    How to export data from html file to excel sheet by using java
Apache POI Excel Maximum Row - JSP-Servlet
Apache POI Excel Maximum Row  I am using Apache POI lib for export jsp results to excel file. I am getting error : Row number must be between 0... row value ? and How can I change that ? Thanks in advance Regards
Excel Cell Comment
Excel Cell Comment In this section, you will learn how to add a comment with a excel cell using Apache POI API. A comment is associated with a cell...(); CreationHelper factory = wb.getCreationHelper(); Sheet sheet = (Sheet
How to export data from html file to excel sheet by using java
How to export data from html file to excel sheet by using java   reading the data from Html file
Selecting Excel Sheet File
. You can set default selected sheet by using setSelected (Boolean value... selecting excel sheet file       In this program we are going to select the excel sheet
Create Excel Sheet Using JSP
create excel sheet using jsp   ... into excel sheet using java .You can create any number of cells and rows... a row  in which we can set the cells. 
How to save excel sheet into mysql database using blob or clob
How to save excel sheet into mysql database using blob or clob  Hi All, I am new to java and i need to upload excel sheet to mysql, please suggest... know to go further, which one should i use BLOB or CLOB ? I have tried using
how to read values from excel sheet and compare with database using jsp
how to read values from excel sheet and compare with database using jsp  hi sir i am arun how to read values from excel sheet and compare with database using jsp coding i.e, if i have 6(assetid,assetname,serialno,cubical
Export data to Excel Sheet in STRUTS 1.3
Export data to Excel Sheet in STRUTS 1.3  hi. how can i export content present on the jsp to excel sheet on button click..... and challenging part...)...... Can any one please provide me with an example...... i have gone through POI API
Inserting Image In Excel Sheet Using JSP
Inserting Image In Excel Sheet Using JSP       In this example, we create excel sheet... can use third party APIs to create the excel sheet, which you can learn in our
Built in Data Format in Excel Using POI 3.0
Built in Data Format in Excel Using POI 3.0  ... in format for formatting our data in excel sheetPOI version 3.0 provides... OLE 2 Compound Document format using Java .POI version 3.0 APIs provides
update excel sheet using jsp::
update excel sheet using jsp::   Hi Sir,... I have a excel sheet for employee details "i retrieve particular datas from given excel sheet and display it into another excel sheet using jsp
how to create exce sheet using java
how to create exce sheet using java  how to create excel sheet using java
Java Program to insert a row in the same sheet of excel file
Java Program to insert a row in the same sheet of excel file  Java program to insert a row in the same sheet of excel file using poi package in java
Excel sheet in read only mode - WebSevices
make changes.But that i dont want,Also i have checked the permission in excel sheet,It has both read and write permission. How can i make the excel sheet...Excel sheet in read only mode  If am opening an excel sheet(through
Reading the Date and time values from excel sheet
Reading the Date and time values from excel sheet  hi guys , iam trying to read excel sheet data using apache poi api .my problem is i cant read the date(dd/mm/yy) and time(hh:mm:ss) values concurrently from two different cells
background image
background image  how to set background image in jsp using netbeans IDE 6.9
Find Type of Excel Sheet
Find Type of Excel Sheet       In this program we are going to find type of an excel sheet using POI3.0 API Event. The methods used in this example: getSid(): This method
How to read a rows which have a values in a excel file using apache poi - JSP-Servlet
How to read a rows which have a values in a excel file using apache poi  Dear sir, How to read excel file in that only a rows which are having some values using apache poi...please help me sir. Thanks and Regards
How to export data from database to excel sheet by using java in standalone project
How to export data from database to excel sheet by using java in standalone project  How to export data from database to excel sheet by using java in standalone project

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.