You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by tom corcoran <os...@gmail.com> on 2008/06/03 12:53:06 UTC

Re: Convert .xls to ascii?

My bad. I needed to have poi-3.1-beta2-20080530.jar in my path and include:
*

import* org.apache.poi.hssf.extractor.ExcelExtractor

*import* org.apache.poi.hssf.usermodel.HSSFWorkbook

*import* org.apache.poi.poifs.filesystem.POIFSFileSystem


On Fri, May 30, 2008 at 5:39 PM, tom corcoran <os...@gmail.com> wrote:

> The text extraction code at that link says:
>
>  InputStream inp = new FileInputStream("workbook.xls");
>  HSSFWorkbook wb = new HSSFWorkbook(new POIFSFileSystem(inp));
>  ExcelExtractor extractor = new ExcelExtractor(wb);
>  extractor.setFormulasNotResults(true);
>  extractor.setIncludeSheetNames(false);
>  String text = extractor.getText();
>
> I cannot find HSSFWorkbook in poi-3.1-beta2-20080530.jar. What am I
> missing?
>
> Also, Doug mentopned that the HSSFRow defines a CellIterator this will
> allow you to iterate through
> the row and get each element. can anyone point me to sample code.
>
> If I can get this worked out maybe we could post the code to a poi snippet
> directory or something. Why should everyone need to reinvent the wheeel
> every time to do a common task like. coverting a .xls to a flat file.
>
> Thanks, Tom.
>
>   On Thu, May 29, 2008 at 7:28 PM, Andy Chien <hs...@utoronto.ca>
> wrote:
>
>> Hi Tom:
>>
>> Though I have not used this feature before, I am aware of the following
>> object. Perhaps it can help? I vaguely recall there were some example on the
>> apache website but I can not seem to find it anymore.
>>
>>
>> http://poi.apache.org/apidocs/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.html
>>
>> http://poi.apache.org/hssf/quick-guide.html#TextExtraction
>>
>> Hope this helps you.
>>
>>
>> Cheers,
>>
>> Andy
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>
>