+ zr = zip_reader_create (filename, &r->zip_errs);
+
+ if (zr == NULL)
+ {
+ if (report_errors)
+ {
+ msg (ME, _("Cannot open %s as a OpenDocument file: %s"),
+ filename, ds_cstr (&r->zip_errs));
+ }
+ ds_destroy (&r->zip_errs);
+ free (r);
+ return NULL;
+ }
+
+ sheet_count = get_sheet_count (zr);
+
+ r->zreader = zr;
+ r->ref_cnt = 1;
+
+ xtr = init_reader (r, report_errors);
+ if (xtr == NULL)
+ {
+ goto error;
+ }
+ r->msd.xtr = xtr;
+ r->msd.row = 0;
+ r->msd.col = 0;
+ r->msd.current_sheet = 0;
+ r->msd.state = STATE_INIT;
+
+
+ r->spreadsheet.n_sheets = sheet_count;
+ r->n_allocated_sheets = 0;
+ r->sheets = NULL;