poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 52622] we use poi excel xssf usermodel to create a excel2007 xlsx file,then we use xssf eventmodel to read it,the ooxml xml content is not right.
Date Wed, 08 Feb 2012 08:59:38 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=52622

--- Comment #4 from wangwei <dmxiaolan@163.com> 2012-02-08 08:59:38 UTC ---
My reading code like that:
OPCPackage pkg = OPCPackage.open(filename);
XSSFReader r = new XSSFReader(pkg);
SharedStringsTable sst = r.getSharedStringsTable();
XMLReader parser = fetchSheetParser(sst);
// how to by sheet name?
InputStream sheet2 = r.getSheet("rId1");
InputSource sheetSource = new InputSource(sheet2);
parser.parse(sheetSource);
sheet2.close();
return resultSet;

public XMLReader fetchSheetParser(SharedStringsTable sst) throws SAXException {
XMLReader parser =
XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
ContentHandler handler = new SAXSheetHandler(sst);
parser.setContentHandler(handler);
return parser;
}

-- 
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message