Esempio n. 1
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;
}
Esempio n. 2
0
static PyObject *
last_row(XLPySheet *self)
{
    return Py_BuildValue("i", xlSheetLastRow(self->handler));
}