How large is your file?

If I am correct - and I could be wrong so forgive me please Chris - the code
that was contributed uses the event driven API. Most often - although by no
means exclusively - this API is used by those wishing to process larger
files without running into memory issues; if your file is fairly small, then
it may be worth your while writing a version of the export routine that uses
the usermodel rather than the eventusermodel. This would give you complete
control over the formatting of the output and prevent you having to wait on
the resolution of what, I assume, is an outstanding issue.

Yours

Mark B

PS It may well be worth searching the list to see if anyone has already
contributed such a routine, you never do know.


gumOnShoe wrote:
> 
> I have an xls file that has some blank columns for some rows.
> 
> When I use the program here (altered for tabs instead of new lines), I get
> a problem:
> http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java
> 
> I receive a new line splitting the above described rows. I would prefer
> that a row be a row regardless of how many empty cells are in it.
> 
> Does anyone know of a simple solution to this problem?
> 
> I imagine that when the records are generated, I am getting some
> misinformation from HSSF...
> 
> The offending code makes itself known here:
> 
> <code>
>               if(record instanceof LastCellOfRowDummyRecord) {
>                       // Print out any missing commas if needed
>                       if(minColumns > 0) {
>                               // Columns are 0 based
>                               if(lastColumnNumber == -1) { lastColumnNumber = 
> 0; }
>                               for(int i=lastColumnNumber; i<(minColumns); 
> i++) {
>                                       output.print('\t');
>                               }
>                       }
>       
>                       // We're onto a new row
>                       lastColumnNumber = -1;
>       
>                       // End the row
>                       output.println("");
>               }
> </code>
> 
> I'm pretty sure some records are being marked as LastCellOfRowDummyRecord
> when they shouldn't be...
> 

-- 
View this message in context: 
http://www.nabble.com/XLS-to-Tab-delimited-getting-extra-new-lines-tp25931161p25935746.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to