This is the only place I could find where LastCellOfRowDummyRecord was
dispatched. And, since I'm unfamiliar with what is going on, I can't be sure
where the bug is... but I am led to believe there has to be one here... :/

Excerpt from MissingRecordAwareHSSFListener
<code>
                // If we're on cells, and this cell isn't in the same
                //  row as the last one, then fire the 
                //  dummy end-of-row records
                if(thisRow != lastCellRow && lastCellRow > -1) {
                        for(int i=lastCellRow; i<thisRow; i++) {
                                int cols = -1;
                                if(i == lastCellRow) {
                                        cols = lastCellColumn;
                                }
                                childListener.processRecord(new 
LastCellOfRowDummyRecord(i, cols));
                        }
                }
                
                // If we've just finished with the cells, then fire the
                // final dummy end-of-row record
                if(lastCellRow != -1 && lastCellColumn != -1 && thisRow == -1) {
                        childListener.processRecord(new 
LastCellOfRowDummyRecord(lastCellRow,
lastCellColumn));
                        
                        lastCellRow = -1;
                        lastCellColumn = -1;
                }
</code>



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-tp25931161p25931768.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