gnumeric r17264 - trunk/plugins/excel
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r17264 - trunk/plugins/excel
- Date: Tue, 31 Mar 2009 23:55:37 +0000 (UTC)
Author: mortenw
Date: Tue Mar 31 23:55:36 2009
New Revision: 17264
URL: http://svn.gnome.org/viewvc/gnumeric?rev=17264&view=rev
Log:
2009-03-31 Morten Welinder <terra gnome org>
* xlsx-write.c: Partial fix for #168875.
* ms-excel-read.c: Ditto.
* ms-excel-write.c: Ditto.
Modified:
trunk/plugins/excel/ChangeLog
trunk/plugins/excel/ms-excel-read.c
trunk/plugins/excel/ms-excel-write.c
trunk/plugins/excel/ms-excel-write.h
trunk/plugins/excel/xlsx-write.c
Modified: trunk/plugins/excel/ms-excel-read.c
==============================================================================
--- trunk/plugins/excel/ms-excel-read.c (original)
+++ trunk/plugins/excel/ms-excel-read.c Tue Mar 31 23:55:36 2009
@@ -282,7 +282,7 @@
static GnmCell *
excel_cell_fetch (BiffQuery *q, ExcelReadSheet *esheet)
{
- unsigned col, row;
+ guint16 col, row;
Sheet *sheet = esheet->sheet;
XL_CHECK_CONDITION_VAL (q->length >= 4, NULL);
@@ -795,7 +795,9 @@
sheet = workbook_sheet_by_name (importer->wb, sheet_name);
if (sheet == NULL) {
- sheet = sheet_new_with_type (importer->wb, sheet_name, type);
+ sheet = sheet_new_with_type (importer->wb, sheet_name, type,
+ gnm_sheet_get_max_cols (NULL),
+ gnm_sheet_get_max_rows (NULL));
workbook_sheet_attach (importer->wb, sheet);
d (1, fprintf (stderr,"Adding sheet '%s'\n", sheet_name););
}
@@ -2002,7 +2004,7 @@
static BiffXFData const *
excel_set_xf (ExcelReadSheet *esheet, BiffQuery *q)
{
- unsigned col, row;
+ guint16 col, row;
BiffXFData const *xf;
GnmStyle *mstyle;
Sheet *sheet = esheet->sheet;
@@ -2815,7 +2817,7 @@
{
GnmCellPos pos;
Sheet *sheet = esheet->sheet;
- unsigned row, col;
+ guint16 row, col;
XL_CHECK_CONDITION (q->length >= 4);
Modified: trunk/plugins/excel/ms-excel-write.c
==============================================================================
--- trunk/plugins/excel/ms-excel-write.c (original)
+++ trunk/plugins/excel/ms-excel-write.c Tue Mar 31 23:55:36 2009
@@ -4690,12 +4690,13 @@
int col, row, max_row, max_col = esheet->max_col;
unsigned ri_start [2]; /* Row info start */
unsigned *rc_start; /* Row cells start */
- guint16 xf_list [SHEET_MAX_COLS];
+ guint16 *xf_list;
GnmRange r;
Sheet *sheet = esheet->gnum_sheet;
TwoWayTable *twt = esheet->ewb->base.xf.two_way_table;
gboolean has_content = FALSE;
+ xf_list = g_new (gint16, gnm_sheet_get_max_cols (esheet->gnum_sheet));
if (nrows > esheet->max_row - (int) begin) /* Incomplete final block? */
nrows = esheet->max_row - (int) begin;
max_row = begin + nrows - 1;
@@ -4767,6 +4768,8 @@
excel_sheet_write_DBCELL (esheet, ri_start, rc_start,
has_content ? nrows : 0, dbcells);
+ g_free (xf_list);
+
return row - 1;
}
@@ -4993,6 +4996,8 @@
g_return_val_if_fail (sheet, NULL);
g_return_val_if_fail (ewb, NULL);
+ esheet->col_xf = g_new (guint16, gnm_sheet_max_cols);
+ esheet->col_style = g_new (GnmStyle*, gnm_sheet_max_cols);
excel_sheet_extent (sheet, &extent, esheet->col_style,
XLS_MaxCol, maxrows, ewb->io_context);
@@ -5061,6 +5066,8 @@
style_list_free (esheet->conditions);
style_list_free (esheet->hlinks);
style_list_free (esheet->validations);
+ g_free (esheet->col_style);
+ g_free (esheet->col_xf);
g_free (esheet);
}
Modified: trunk/plugins/excel/ms-excel-write.h
==============================================================================
--- trunk/plugins/excel/ms-excel-write.h (original)
+++ trunk/plugins/excel/ms-excel-write.h Tue Mar 31 23:55:36 2009
@@ -45,8 +45,8 @@
unsigned streamPos;
guint32 boundsheetPos;
gint32 max_col, max_row;
- guint16 col_xf [SHEET_MAX_COLS];
- GnmStyle *col_style [SHEET_MAX_COLS];
+ guint16 *col_xf;
+ GnmStyle **col_style;
GnmStyleList *conditions, *hlinks, *validations;
GSList *blips, *textboxes;
GHashTable *comments;
Modified: trunk/plugins/excel/xlsx-write.c
==============================================================================
--- trunk/plugins/excel/xlsx-write.c (original)
+++ trunk/plugins/excel/xlsx-write.c Tue Mar 31 23:55:36 2009
@@ -223,8 +223,8 @@
g_object_unref (part);
}
-#define XLSX_MAX_COLS SHEET_MAX_COLS /* (2^14) */
-#define XLSX_MAX_ROWS SHEET_MAX_ROWS /* (2^20) */
+#define XLSX_MAX_COLS gnm_sheet_get_max_cols (state->sheet) /* default is (2^14) */
+#define XLSX_MAX_ROWS gnm_sheet_get_max_rows (state->sheet) /* default is (2^20) */
static void
xlsx_write_sheet_view (GsfXMLOut *xml, SheetView const *sv)
@@ -1253,12 +1253,12 @@
GnmRange extent;
GSList *charts;
char const *chart_drawing_rel_id = NULL;
- GnmStyle *col_styles [MIN (XLSX_MAX_COLS, SHEET_MAX_COLS)];
+ GnmStyle **col_styles = g_new (GnmStyle*, MIN (XLSX_MAX_COLS, gnm_sheet_get_max_cols (state->sheet)));
state->sheet = workbook_sheet_by_index (state->base.wb, i);
excel_sheet_extent (state->sheet, &extent, col_styles,
- MIN (XLSX_MAX_COLS, SHEET_MAX_COLS),
- MIN (XLSX_MAX_ROWS, SHEET_MAX_ROWS), state->io_context);
+ MIN (XLSX_MAX_COLS, gnm_sheet_get_max_cols (state->sheet)),
+ MIN (XLSX_MAX_ROWS, gnm_sheet_get_max_rows (state->sheet)), state->io_context);
charts = sheet_objects_get (state->sheet, NULL, SHEET_OBJECT_GRAPH_TYPE);
if (NULL != charts) {
@@ -1323,6 +1323,7 @@
gsf_output_close (sheet_part);
g_object_unref (sheet_part);
g_free (name);
+ g_free (col_styles);
return rId;
}
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]