Esempio n. 1
0
File: extract.c Progetto: icune/R
int main()
{
    BookHandle book = xlCreateBook();
    if(book) 
    {
        if(xlBookLoad(book, L"example.xls")) 
        {
            SheetHandle sheet = xlBookGetSheet(book, 0);
            if(sheet)
            {
                double d;
                const wchar_t* s = xlSheetReadStr(sheet, 2, 1, 0);

                if(s) wprintf(L"%s\n", s);

                d = xlSheetReadNum(sheet, 3, 1, 0);
                printf("%g\n", d);
            }
        }     
       
        xlBookRelease(book);
    }

    printf("\nPress any key to exit...");
    _getch();

    return 0;
}
Esempio n. 2
0
int main()
{
    BookHandle book = xlCreateBook();
    if(book) 
    {
        if(xlBookLoad(book, "example.xls")) 
        {
            SheetHandle sheet = xlBookGetSheet(book, 0);
            if(sheet)
            {
                double d;
                const char* s = xlSheetReadStr(sheet, 2, 1, 0);

                if(s) printf("%s\n", s);

                d = xlSheetReadNum(sheet, 3, 1, 0);
                printf("%g\n", d);
            }
        }     
       
        xlBookRelease(book);
    }

    return 0;
}
Esempio n. 3
0
static PyObject *
get_sheet(XLPyBook *self, PyObject *args)
{
	int num;
	if(!PyArg_ParseTuple(args, "i", &num))
		return NULL;

	SheetHandle sheet = xlBookGetSheet(self->handler, num);
	if (!sheet)
		Py_RETURN_NONE;

	XLPySheet *obj = PyObject_New(XLPySheet, &XLPySheetType);
	obj->handler = sheet;
	return (PyObject *)obj;
}
Esempio n. 4
0
File: read.c Progetto: antontest/c
int main(int argc, char **argv)
{
    SheetHandle sheet;
    BookHandle book = xlCreateBook();

    if (!book) return -1;

    xlBookLoad(book, "example.xls");
    sheet = xlBookGetSheet(book, 3);
    int row = xlSheetLastRow(sheet);
    int col = xlSheetLastCol(sheet);
    int i = 0, j = 0;
    char *str = NULL;
    int num;

    for (i = 0; i < row; i++) {
        for (j = 0; j < col; j++) {
            if (i != 0 && ( j == 0 || j == 4 || j == 5)) {
                num = xlSheetReadNum(sheet, i, j, 0);
                if (num > 0)
                    printf("%d ", num);
                else printf(" ");
            } else {
                str = (char *)xlSheetReadStr(sheet, i, j, 0);
                if (!str) {
                } else {
                    printf("%s ", str);
                }
            }
        }
        printf("\n");
    }
    //xlSheetWriteNum(sheet, 1, 1, 1111, 0);
    //xlBookSave(book, "example.xls");
    xlBookRelease(book);

    return 0;
}