- xmlChar *value = xmlTextReaderGetAttribute (r->xtr, _xml ("table:name"));
- r->sheets = xrealloc (r->sheets, sizeof (*r->sheets) * ++r->n_allocated_sheets);
- r->sheets[r->n_allocated_sheets - 1].start_col = -1;
- r->sheets[r->n_allocated_sheets - 1].stop_col = -1;
- r->sheets[r->n_allocated_sheets - 1].start_row = -1;
- r->sheets[r->n_allocated_sheets - 1].stop_row = -1;
- r->sheets[r->n_allocated_sheets - 1].name = value;
- r->col = -1;
- r->row = -1;
- r->max_col = -1;
- r->min_col = INT_MAX;
- ++r->sheet_index;
-
- printf ("%s:%d Start of SHEET %d: Rows %d\n", __FILE__, __LINE__,
- r->sheet_index, r->row);
-
- if ( r->target_sheet != NULL)
- {
- if ( 0 == xmlStrcmp (value, r->target_sheet))
- {
- r->sheet_found = true;
- }
- }
- else if (r->target_sheet_index == r->sheet_index)
+ xmlFree (r->current_sheet_name);
+ r->current_sheet_name = xmlTextReaderGetAttribute (r->xtr, _xml ("table:name"));
+
+ ++r->current_sheet;
+
+ if (r->current_sheet >= or->n_allocated_sheets)