- if (r->sheets[r->sheet_index].start_row == -1)
- r->sheets[r->sheet_index].start_row = r->row;
- // printf ("%s:%d Cell contents: Rows %d\n", __FILE__, __LINE__, r->row);
- /* if (XML_READER_TYPE_TEXT != r->node_type) */
- r->state = STATE_CELL;
+ assert (r->current_sheet >= 0);
+ assert (r->current_sheet < r->n_allocated_sheets);
+
+ if (r->sheets[r->current_sheet].start_row == -1)
+ r->sheets[r->current_sheet].start_row = r->row - 1;
+
+ if (
+ (r->sheets[r->current_sheet].start_col == -1)
+ ||
+ (r->sheets[r->current_sheet].start_col >= r->col - 1)
+ )
+ r->sheets[r->current_sheet].start_col = r->col - 1;
+
+ r->sheets[r->current_sheet].stop_row = r->row - 1;
+
+ if ( r->sheets[r->current_sheet].stop_col < r->col - 1)
+ r->sheets[r->current_sheet].stop_col = r->col - 1;
+
+ if (XML_READER_TYPE_END_ELEMENT == r->node_type)
+ r->state = STATE_CELL;