View | Details | Raw Unified | Return to bug 45672
Collapse All | Expand All

(-)trunk/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java (-2 / +12 lines)
Lines 33-38 Link Here
33
import org.apache.poi.hssf.record.RKRecord;
33
import org.apache.poi.hssf.record.RKRecord;
34
import org.apache.poi.hssf.record.Record;
34
import org.apache.poi.hssf.record.Record;
35
import org.apache.poi.hssf.record.RowRecord;
35
import org.apache.poi.hssf.record.RowRecord;
36
import org.apache.poi.hssf.record.SharedFormulaRecord;
36
37
37
/**
38
/**
38
 * <p>A HSSFListener which tracks rows and columns, and will
39
 * <p>A HSSFListener which tracks rows and columns, and will
Lines 68-74 Link Here
68
	public void processRecord(Record record) {
69
	public void processRecord(Record record) {
69
		int thisRow = -1;
70
		int thisRow = -1;
70
		int thisColumn = -1;
71
		int thisColumn = -1;
71
		
72
		boolean ignoreRecord = false;
73
                
72
		switch (record.getSid())
74
		switch (record.getSid())
73
        {
75
        {
74
            // the BOFRecord can represent either the beginning of a sheet or the workbook
76
            // the BOFRecord can represent either the beginning of a sheet or the workbook
Lines 129-134 Link Here
129
            	thisRow = frec.getRow();
131
            	thisRow = frec.getRow();
130
            	thisColumn = frec.getColumn();
132
            	thisColumn = frec.getColumn();
131
                break;
133
                break;
134
            case SharedFormulaRecord.sid:
135
                // Fix issue with LastCellOfRowDummyRecord events being returned incorrectly when a
136
                // SharedFormulaRecord is processed.
137
                // Shared formula records should be ignored in the MissingRecordAwareHSSFListener 
138
                ignoreRecord = true;
139
                break;
132
            case LabelRecord.sid:
140
            case LabelRecord.sid:
133
            	LabelRecord lrec = (LabelRecord) record;
141
            	LabelRecord lrec = (LabelRecord) record;
134
                thisRow = lrec.getRow();
142
                thisRow = lrec.getRow();
Lines 164-170 Link Here
164
            	//System.out.println(record.getClass());
172
            	//System.out.println(record.getClass());
165
            	break;
173
            	break;
166
        }
174
        }
167
		
175
          if (!ignoreRecord) {
176
                
168
		// If we're on cells, and this cell isn't in the same
177
		// If we're on cells, and this cell isn't in the same
169
		//  row as the last one, then fire the 
178
		//  row as the last one, then fire the 
170
		//  dummy end-of-row records?
179
		//  dummy end-of-row records?
Lines 211-215 Link Here
211
		}
220
		}
212
		
221
		
213
		childListener.processRecord(record);
222
		childListener.processRecord(record);
223
          }
214
	}
224
	}
215
}
225
}

Return to bug 45672