https://issues.apache.org/bugzilla/show_bug.cgi?id=46259
--- Comment #1 from Axel Rose <[EMAIL PROTECTED]> 2008-11-21 08:15:53 PST ---
My test code:
---
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Iterator;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
public class TestUserStyle {
public static void main(String[] args) throws Exception {
if (args.length == 0 || args[0] == null) {
System.err.println("no input, no output");
Runtime.getRuntime().exit(1);
}
File inputFile = new File(args[0]);
if (!inputFile.canRead())
throw new Exception("cannot read '" + args[0] + "'");
InputStream inp = new FileInputStream(args[0]);
HSSFWorkbook wb = new HSSFWorkbook(new POIFSFileSystem(inp));
HSSFSheet sheet = wb.getSheetAt(0);
if (sheet == null)
throw new Exception("cannot get sheet 0");
Iterator<?> rowIterator = sheet.rowIterator();
while (rowIterator.hasNext()) {
HSSFRow row = (HSSFRow) rowIterator.next();
Iterator<?> cellIterator = row.cellIterator();
while (cellIterator.hasNext()) {
HSSFCell cell = (HSSFCell) cellIterator.next();
HSSFCellStyle cellStyle = cell.getCellStyle();
String userStyleName = cellStyle.getUserStyleName();
System.out.println("row " + row.getRowNum() + ", col " +
cell.getColumnIndex());
if (userStyleName != null)
System.out.println(" user style: " + userStyleName);
else
System.out.println(" no user style");
}
}
}
}
---
Result:
row 0, col 0
no user style
row 1, col 0
no user style
row 2, col 0
no user style
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]