poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Allison <talli...@apache.org>
Subject Re: Is it POI error starting 3.14 version onwards
Date Wed, 16 May 2018 12:59:07 GMT
Sorry for my delay.  I just tested your file with Apache Tika 1.18 which
uses POI 3.17..., and I got:


<body><div><h1>Sheet1</h1>
<table><tbody><tr>      <td>Salary</td></tr>
<tr>    <td>99.965432</td></tr>
</tbody></table>
</div>
<div><h1>Sheet2</h1>
<table><tbody/></table>
</div>
<div><h1>Sheet3</h1>
<table><tbody/></table>
</div>
</body></html>

That's promising...  Let me take a look at your example code.

On Wed, May 16, 2018 at 1:31 AM, Syed Mudassir Ahmed <
syed.mudassir@gaianconsultants.com> wrote:

> any update on this pls?  This is blocking me.
>
> Thanks,
>
>
> On Tue, May 15, 2018 at 3:45 PM, Syed Mudassir Ahmed <syed.mudassir@
> gaianconsultants.com> wrote:
>
>> Yes, pls find the file attached here.
>>
>> Thanks,
>>
>>
>> On Tue, May 15, 2018 at 3:43 PM, Tim Allison <tallison@apache.org> wrote:
>>
>>> Any chanc you can share the file?
>>>
>>> On Tue, May 15, 2018 at 3:19 AM Syed Mudassir Ahmed <
>>> syed.mudassir@gaianconsultants.com> wrote:
>>>
>>> > Hi,
>>> >   I am trying to read data from a XLSX sheet via XSSFSheetXMLHandler.
>>> The
>>> > source code is below.
>>> >
>>> >   public static void main(String str[]) throws Exception {
>>> >         String filePath
>>> >                 = "/home/gaian/Desktop/salary.xlsx";
>>> >         File file = new File(filePath);
>>> >         InputStream inputStream = new FileInputStream(file);
>>> >         OPCPackage pkg = OPCPackage.open(inputStream);
>>> >
>>> >         SheetContentsHandler sheetContentsHandler = new
>>> > SheetContentsHandler() {
>>> >             @Override
>>> >             public void startRow(int rowIndex) {
>>> >             }
>>> >
>>> >             @Override
>>> >             public void endRow(int i) {
>>> >             }
>>> >
>>> >             @Override
>>> >             public void cell(String cell, String formattedValue,
>>> > XSSFComment c) {
>>> >                 System.out.println("cell encountered with addess:<" +
>>> cell
>>> >                         + "> and value:<" + formattedValue + ">");
>>> >             }
>>> >
>>> >             @Override
>>> >             public void headerFooter(String text, boolean isHeader,
>>> String
>>> > tagName) {
>>> >                 System.out.println("headerFooter()");
>>> >             }
>>> >         };
>>> >
>>> >         ReadOnlySharedStringsTable strings = new
>>> > ReadOnlySharedStringsTable(pkg);
>>> >         XSSFReader xssfReader = new XSSFReader(pkg);
>>> >         StylesTable styles = xssfReader.getStylesTable();
>>> >         XSSFReader.SheetIterator worksheets =
>>> (XSSFReader.SheetIterator)
>>> > xssfReader.getSheetsData();
>>> >         InputStream stream = worksheets.next();
>>> >         SAXParserFactory saxFactory = SAXParserFactory.newInstance();
>>> >         XMLReader sheetParser = saxFactory.newSAXParser().getX
>>> MLReader();
>>> >
>>> >         ContentHandler handler
>>> >                 = new XSSFSheetXMLHandler(styles, strings,
>>> > sheetContentsHandler, false);
>>> >
>>> >         sheetParser.setContentHandler(handler);
>>> >         sheetParser.parse(new InputSource(stream));
>>> >     }
>>> >
>>> >   When I use the POI version 3.13, I am getting the following output:
>>> >
>>> > cell encountered with addess:<A1> and value:<Salary>
>>> > cell encountered with addess:<A2> and value:<99.965432>
>>> >
>>> >   The moment I switch to version 3.14 or higher, I am no longer getting
>>> > any output.
>>> >
>>> >   Can someone pls let me know if any more code changes needed if I
>>> switch
>>> > to 3.14 or higher?  I even checked the test cases in Apache POI 3.17
>>> > sources but was shocked not to find any there.  Any example/references
>>> that
>>> > I can go through pls?  This is blocker for one of my applications.
>>> >
>>> >
>>> > Thanks,
>>> >
>>> >
>>>
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message