Commit fe7e96e2 authored by Michael Meeks's avatar Michael Meeks

V/Hlookup fix, cleaned bits.

parent c511136b
1999-04-15 Michael Meeks <michael@mejm2.dow.cam.ac.uk>
* src/fn-lookup.c: Silly bug in types fixed.
* src/expr.c (eval_funcall): Made cellrefs absoulte.
* src/cell.c (cell_set_text_simple): Fix for 1.234E-07
1999-04-13 Miguel de Icaza <miguel@nuclecu.unam.mx>
......
1999-04-15 Michael Meeks <michael@mejm2.dow.cam.ac.uk>
* src/fn-lookup.c: Silly bug in types fixed.
* src/expr.c (eval_funcall): Made cellrefs absoulte.
* src/cell.c (cell_set_text_simple): Fix for 1.234E-07
1999-04-13 Miguel de Icaza <miguel@nuclecu.unam.mx>
......
1999-04-15 Michael Meeks <michael@mejm2.dow.cam.ac.uk>
* src/fn-lookup.c: Silly bug in types fixed.
* src/expr.c (eval_funcall): Made cellrefs absoulte.
* src/cell.c (cell_set_text_simple): Fix for 1.234E-07
1999-04-13 Miguel de Icaza <miguel@nuclecu.unam.mx>
......
1999-04-15 Michael Meeks <michael@mejm2.dow.cam.ac.uk>
* src/fn-lookup.c: Silly bug in types fixed.
* src/expr.c (eval_funcall): Made cellrefs absoulte.
* src/cell.c (cell_set_text_simple): Fix for 1.234E-07
1999-04-13 Miguel de Icaza <miguel@nuclecu.unam.mx>
......
1999-04-15 Michael Meeks <michael@mejm2.dow.cam.ac.uk>
* boot.c: Fixed includes to remove annoying warning.
(excel_load): Add workbook_set_filename for style.
* ms-excel.c (ms_excel_workbook_detach): Added debug
if can't remove sheet for some reason.
* ms-ole.c (pps_get_text): Hacked in some better
unicode support. Might work cross-platform now.
(ms_ole_new): Added name printout to help debug.
(ms_ole_directory_next): Conditional'd debug.
(directory_setup): clean debug.
* ms-excel.c (ms_excel_set_cell_colors): Removed debug.
1999-04-15 Michael Meeks <michael@mejm2.dow.cam.ac.uk>
* ms-formula.c (ms_excel_parse_formula): PTG_AREAN added,
......
......@@ -16,18 +16,11 @@
#include <ctype.h>
#include <gnome.h>
#include "gnumeric.h"
#include "gnumeric-util.h"
#include "gnome-xml/tree.h"
#include "gnome-xml/parser.h"
#include "color.h"
#include "sheet-object.h"
#include "style.h"
#include "sheet.h"
#include "file.h"
#include "ms-ole.h"
#include "ms-biff.h"
#include "ms-formula.h"
#include "ms-excel.h"
#include "ms-excel-biff.h"
#include "boot.h"
static gboolean
......@@ -56,6 +49,12 @@ excel_load (const char *filename)
return NULL;
wb = ms_excelReadWorkbook (f);
if (wb) {
char *name = g_strconcat (filename, ".gnumeric", NULL);
workbook_set_filename (wb, name);
g_free(name);
}
ms_ole_destroy (f);
return wb;
......
......@@ -816,9 +816,10 @@ ms_excel_set_cell_colors (MS_EXCEL_SHEET * sheet, Cell * cell, BIFF_XF_DATA * xf
fore = basefore;
back = ms_excel_palette_get (sheet->wb->palette, xf->pat_foregnd_col);
}
g_return_if_fail (fore);
g_return_if_fail (back);
cell_set_color_from_style (cell, fore, back);
if (fore && back)
cell_set_color_from_style (cell, fore, back);
else if (EXCEL_DEBUG>0)
printf ("Missing color\n");
}
/**
......@@ -1333,8 +1334,11 @@ ms_excel_workbook_detach (MS_EXCEL_WORKBOOK * wb, MS_EXCEL_SHEET * ans)
int idx = 0 ;
GList *list = wb->excel_sheets ;
if (ans->gnum_sheet)
workbook_detach_sheet (wb->gnum_wb, ans->gnum_sheet);
if (ans->gnum_sheet) {
if (!workbook_detach_sheet (wb->gnum_wb, ans->gnum_sheet))
printf ("Error detaching sheet: '%s'\n",
ans->gnum_sheet->name?ans->gnum_sheet->name:"noname");
}
while (list)
if (list->data == ans)
......
......@@ -816,9 +816,10 @@ ms_excel_set_cell_colors (MS_EXCEL_SHEET * sheet, Cell * cell, BIFF_XF_DATA * xf
fore = basefore;
back = ms_excel_palette_get (sheet->wb->palette, xf->pat_foregnd_col);
}
g_return_if_fail (fore);
g_return_if_fail (back);
cell_set_color_from_style (cell, fore, back);
if (fore && back)
cell_set_color_from_style (cell, fore, back);
else if (EXCEL_DEBUG>0)
printf ("Missing color\n");
}
/**
......@@ -1333,8 +1334,11 @@ ms_excel_workbook_detach (MS_EXCEL_WORKBOOK * wb, MS_EXCEL_SHEET * ans)
int idx = 0 ;
GList *list = wb->excel_sheets ;
if (ans->gnum_sheet)
workbook_detach_sheet (wb->gnum_wb, ans->gnum_sheet);
if (ans->gnum_sheet) {
if (!workbook_detach_sheet (wb->gnum_wb, ans->gnum_sheet))
printf ("Error detaching sheet: '%s'\n",
ans->gnum_sheet->name?ans->gnum_sheet->name:"noname");
}
while (list)
if (list->data == ans)
......
......@@ -159,6 +159,7 @@ pps_get_text (BYTE *ptr, int length)
{
int lp, skip;
char *ans;
guint16 c;
BYTE *inb;
if (!length)
......@@ -166,14 +167,14 @@ pps_get_text (BYTE *ptr, int length)
ans = (char *)g_malloc (sizeof(char) * length + 1);
skip = (ptr[0] < 0x30); /* Magic unicode number */
if (skip)
c = GET_GUINT16(ptr);
if (c<0x30) /* Magic unicode number I made up */
inb = ptr + 2;
else
inb = ptr;
for (lp=0;lp<length;lp++)
{
ans[lp] = (char) *inb;
for (lp=0;lp<length;lp++) {
c = GET_GUINT16(inb);
ans[lp] = (char)c;
inb+=2;
}
ans[lp] = 0;
......@@ -529,7 +530,7 @@ ms_ole_new (const char *name)
ms_ole_destroy(f);
return 0;
}
printf ("New OLE file\n");
printf ("New OLE file '%s'\n", name);
return f;
}
......@@ -1265,7 +1266,8 @@ ms_ole_directory_new (MS_OLE *f)
static void
directory_setup (MS_OLE_DIRECTORY *d)
{
printf ("Setup pps = %d\n", d->pps);
if (OLE_DEBUG>0)
printf ("Setup pps = %d\n", d->pps);
g_free (d->name);
d->name = PPS_NAME(d->file, d->pps);
d->type = PPS_GET_TYPE(d->file, d->pps);
......@@ -1300,7 +1302,8 @@ ms_ole_directory_next (MS_OLE_DIRECTORY *d)
tmp != PPS_END_OF_CHAIN)
{
offset--;
printf ("Back trace by %d\n", offset);
if (OLE_DEBUG>0)
printf ("Back trace by %d\n", offset);
tmp = d->primary_entry;
while (offset > 0)
{
......@@ -1318,11 +1321,13 @@ ms_ole_directory_next (MS_OLE_DIRECTORY *d)
if (tmp == PPS_END_OF_CHAIN)
return 0;
printf ("Forward trace\n");
if (OLE_DEBUG>0)
printf ("Forward trace\n");
d->pps = tmp;
directory_setup(d);
printf ("Next '%s' %d %d\n", d->name, d->type, d->length);
if (OLE_DEBUG>0)
printf ("Next '%s' %d %d\n", d->name, d->type, d->length);
return 1;
}
......
......@@ -363,10 +363,10 @@ gnumeric_rows (struct FunctionDefinition *i, Value *argv [], char **error_string
FunctionDefinition lookup_functions [] = {
{ "column", "?", "ref", &help_column, gnumeric_column, NULL },
{ "columns", "A", "ref", &help_column, NULL, gnumeric_columns },
{ "hlookup", "Arf|b","val,range,col_idx,approx", &help_hlookup, NULL, gnumeric_hlookup },
{ "hlookup", "?Af|b","val,range,col_idx,approx", &help_hlookup, NULL, gnumeric_hlookup },
{ "row", "?", "ref", &help_row, gnumeric_row, NULL },
{ "rows", "A", "ref", &help_rows, NULL, gnumeric_rows },
{ "vlookup", "Arf|b","val,range,col_idx,approx", &help_vlookup, NULL, gnumeric_vlookup },
{ "vlookup", "?Af|b","val,range,col_idx,approx", &help_vlookup, NULL, gnumeric_vlookup },
{ NULL, NULL }
};
......
......@@ -689,6 +689,11 @@ eval_funcall (Sheet *sheet, ExprTree *tree, int eval_col, int eval_row, char **e
if (v->type != VALUE_ARRAY &&
v->type != VALUE_CELLRANGE)
type_mismatch = 1;
if (v->type == VALUE_CELLRANGE) {
cell_ref_make_absolute (&v->v.cell_range.cell_a, eval_col, eval_row);
cell_ref_make_absolute (&v->v.cell_range.cell_b, eval_col, eval_row);
}
break;
}
if (type_mismatch){
......
......@@ -363,10 +363,10 @@ gnumeric_rows (struct FunctionDefinition *i, Value *argv [], char **error_string
FunctionDefinition lookup_functions [] = {
{ "column", "?", "ref", &help_column, gnumeric_column, NULL },
{ "columns", "A", "ref", &help_column, NULL, gnumeric_columns },
{ "hlookup", "Arf|b","val,range,col_idx,approx", &help_hlookup, NULL, gnumeric_hlookup },
{ "hlookup", "?Af|b","val,range,col_idx,approx", &help_hlookup, NULL, gnumeric_hlookup },
{ "row", "?", "ref", &help_row, gnumeric_row, NULL },
{ "rows", "A", "ref", &help_rows, NULL, gnumeric_rows },
{ "vlookup", "Arf|b","val,range,col_idx,approx", &help_vlookup, NULL, gnumeric_vlookup },
{ "vlookup", "?Af|b","val,range,col_idx,approx", &help_vlookup, NULL, gnumeric_vlookup },
{ NULL, NULL }
};
......
......@@ -363,10 +363,10 @@ gnumeric_rows (struct FunctionDefinition *i, Value *argv [], char **error_string
FunctionDefinition lookup_functions [] = {
{ "column", "?", "ref", &help_column, gnumeric_column, NULL },
{ "columns", "A", "ref", &help_column, NULL, gnumeric_columns },
{ "hlookup", "Arf|b","val,range,col_idx,approx", &help_hlookup, NULL, gnumeric_hlookup },
{ "hlookup", "?Af|b","val,range,col_idx,approx", &help_hlookup, NULL, gnumeric_hlookup },
{ "row", "?", "ref", &help_row, gnumeric_row, NULL },
{ "rows", "A", "ref", &help_rows, NULL, gnumeric_rows },
{ "vlookup", "Arf|b","val,range,col_idx,approx", &help_vlookup, NULL, gnumeric_vlookup },
{ "vlookup", "?Af|b","val,range,col_idx,approx", &help_vlookup, NULL, gnumeric_vlookup },
{ NULL, NULL }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment