示例#1
0
文件: generate.c 项目: antontest/c
int main()
{
    BookHandle book = xlCreateBook();
    if(book) 
    {
        SheetHandle sheet = xlBookAddSheet(book, "Sheet1", 0);
        if(sheet) 
        {
            FormatHandle dateFormat;

            xlSheetWriteStr(sheet, 2, 1, "Hello, World !", 0);
            xlSheetWriteNum(sheet, 3, 1, 1000, 0);

            dateFormat = xlBookAddFormat(book, 0);
            xlFormatSetNumFormat(dateFormat, NUMFORMAT_DATE);
            xlSheetWriteNum(sheet, 4, 1, xlBookDatePack(book, 2008, 4, 29, 0, 0, 0, 0), dateFormat);

            xlSheetSetCol(sheet, 1, 1, 12, 0, 0);
        }

        if(xlBookSave(book, "example.xls")) printf("File example.xls has been created.\n");
        xlBookRelease(book);
    }

    return 0;
}
示例#2
0
文件: book.c 项目: nahody/libxlpy
static PyObject *
date_pack(XLPyBook *self, PyObject *args)
{
	int year, month, day, hour, min, sec, msec;
	if(!PyArg_ParseTuple(args, "iiiiiii",
				&year, &month, &day, &hour, &min, &sec, &msec)) {
		return NULL;
	}

	double pack = xlBookDatePack(self->handler,
			year, month, day, hour, min, sec, msec);
	return Py_BuildValue("d", pack);
}