poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Navin Nair" <navin_n...@infosys.com>
Subject POI Query: Retrieving background color information
Date Fri, 05 Mar 2004 03:38:25 GMT
Hi All,

I am new to POI and I am using it to read an excel sheet which has some rows/columns marked
in a particular color. I have some processing to be done based on the style (for eg: color)
of the cell. But when I do style.getFillBackgroundColor(), I always get 64 as the value for
any color. I have attached the code I am using with this mail.

		String filename = "C:/WorkBook.xls";
		POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(filename));
		HSSFWorkbook wb = new HSSFWorkbook(fs);
		HSSFSheet sheet = wb.getSheetAt(0);

		for( int r = 0; r <= sheet.getLastRowNum(); r++ ) {
			HSSFRow row   = sheet.getRow(r);
			System.out.println("Row : " + r);
			if( row != null ) {
				for( short c = 0; c <= row.getLastCellNum(); c++ ) {
					HSSFCell cell = row.getCell(c);
					if( cell != null ) {
						HSSFCellStyle style = cell.getCellStyle();
						System.out.println(style.getFillBackgroundColor() + " " + 
						  style.getFillPattern() + " " + cell.getStringCellValue());
					}
				}
			}
		}

I think I am doing something wrong or have missed something. Can somebody please point out
what needs to be done to get a background color?.

Regards,
Navin

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


Mime
View raw message