}
r->spreadsheet.type = SPREADSHEET_GNUMERIC;
+ r->spreadsheet.file_name = filename;
return &r->spreadsheet;
}
if ( n_var_specs == 0 )
{
msg (MW, _("Selected sheet or range of spreadsheet `%s' is empty."),
- gri->file_name);
+ spreadsheet->file_name);
goto error;
}
if (opts->cell_range == NULL)
{
- opts->cell_range = c_xasprintf ("%c%d:%c%d",
+ opts->cell_range = c_xasprintf ("%c%d:%c%ld",
r->start_col + 'A',
r->start_row,
r->stop_col + 'A' + caseproto_get_n_widths (r->proto),
#define _(msgid) gettext (msgid)
#define N_(msgid) (msgid)
-static bool parse_spreadsheet (struct lexer *lexer, struct spreadsheet_read_info *sri,
+static bool parse_spreadsheet (struct lexer *lexer, char **filename, struct spreadsheet_read_info *sri,
struct spreadsheet_read_options *opts);
static void destroy_spreadsheet_read_info (struct spreadsheet_read_info *, struct spreadsheet_read_options *);
else if (lex_match_id (lexer, "GNM") ||
lex_match_id (lexer, "ODS"))
{
+ char *filename = NULL;
struct casereader *reader = NULL;
struct dictionary *dict = NULL;
struct spreadsheet_read_info sri;
struct spreadsheet_read_options opts;
- if (!parse_spreadsheet (lexer, &sri, &opts))
+ if (!parse_spreadsheet (lexer, &filename, &sri, &opts))
goto error;
if ( 0 == strncasecmp (tok, "GNM", 3))
{
- struct spreadsheet *spreadsheet = gnumeric_probe (sri.file_name);
+ struct spreadsheet *spreadsheet = gnumeric_probe (filename);
reader = gnumeric_make_reader (spreadsheet, &sri, &opts);
dict = spreadsheet->dict;
}
else if (0 == strncasecmp (tok, "ODS", 3))
{
- struct spreadsheet *spreadsheet = ods_probe (sri.file_name);
+ struct spreadsheet *spreadsheet = ods_probe (filename);
reader = ods_make_reader (spreadsheet, &sri, &opts);
dict = spreadsheet->dict;
}
}
static bool
-parse_spreadsheet (struct lexer *lexer, struct spreadsheet_read_info *sri,
+parse_spreadsheet (struct lexer *lexer, char **filename, struct spreadsheet_read_info *sri,
struct spreadsheet_read_options *opts)
{
opts->sheet_index = 1;
opts->cell_range = NULL;
sri->read_names = true;
sri->asw = -1;
- sri->file_name = NULL;
lex_force_match (lexer, T_SLASH);
if (!lex_force_string (lexer))
goto error;
- sri->file_name = utf8_to_filename (lex_tokcstr (lexer));
+ *filename = utf8_to_filename (lex_tokcstr (lexer));
lex_get (lexer);
{
free (opts->sheet_name);
free (opts->cell_range);
- free (sri->file_name);
}
opts.cell_range = NULL;
opts.sheet_index = 1;
- sri.file_name = file->file_name;
sri.read_names = true;
sri.asw = -1;
if (ssp->spreadsheet == NULL)
- ssp->spreadsheet = gnumeric_probe (sri.file_name);
+ ssp->spreadsheet = gnumeric_probe (file->file_name);
if (ssp->spreadsheet == NULL)
- ssp->spreadsheet = ods_probe (sri.file_name);
+ ssp->spreadsheet = ods_probe (file->file_name);
if (ssp->spreadsheet)
{
-
// update_assistant (ia);
}
else
GtkBuilder *builder = ia->asst.builder;
- struct file *file = &ia->file;
struct sheet_spec_page *ssp = ia->sheet_spec;
struct casereader *creader = NULL;
struct dictionary *dict = NULL;
ssp->opts.cell_range = range;
}
- ssp->sri.file_name = file->file_name;
ssp->sri.read_names = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (readnames_checkbox));
ssp->sri.asw = -1;