Esempio n. 1
0
int main()
{
    BasicExcel xls;
    // create sheet 1 and get the associated BasicExcelWorksheet pointer
    xls.New(1);
    xls.workbook_.definedName_.setName("shit");
    BasicExcelWorksheet* sheet = xls.GetWorksheet(0);


    XLSFormatManager fmt_mgr(xls);

    ExcelFont font_header;
    font_header.set_weight(FW_BOLD);
    font_header.set_underline_type(EXCEL_UNDERLINE_SINGLE);
    font_header.set_font_name(L"Times New Roman");
    font_header.set_color_index(EGA_BLUE);
    font_header._options = EXCEL_FONT_STRUCK_OUT;

    CellFormat fmt_header(fmt_mgr, font_header);
    fmt_header.set_rotation(30); // rotate the header cell text 30?to the left

    int row = 0;

    for(int col=0; col<10; ++col) {
        BasicExcelCell* cell = sheet->Cell(row, col);

        cell->Set("TITLE");
        cell->SetFormat(fmt_header);
    }

    char buffer[100];

    while(++row < 10) {
        for(int col=0; col<10; ++col) {
            sprintf(buffer, "text %d/%d", row, col);

            sheet->Cell(row, col)->Set(buffer);
        }
    }

    xls.SaveAs("fasdf.xls");
    xls.Close();
}