Ejemplo n.º 1
0
int main() {

    /* Create a new workbook and add a worksheet. */
    lxw_workbook  *workbook  = workbook_new("hide_row_col.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
    lxw_row_t row;

    /* Write some data. */
    worksheet_write_string(worksheet, 0, 3, "Some hidden columns.", NULL);
    worksheet_write_string(worksheet, 7, 0, "Some hidden rows.",    NULL);

    /* Hide all rows without data. */
    worksheet_set_default_row(worksheet, 15, LXW_TRUE);

    /* Set the height of empty rows that we do want to display even if it is */
    /* the default height. */
    for (row = 1; row <= 6; row++)
        worksheet_set_row(worksheet, row, 15, NULL);

    /* Columns can be hidden explicitly. This doesn't increase the file size. */
    lxw_row_col_options options = {.hidden = 1};
    worksheet_set_column_opt(worksheet, COLS("G:XFD"), 8.43, NULL, &options);

    workbook_close(workbook);

    return 0;
}
Ejemplo n.º 2
0
int main() {

    lxw_workbook  *workbook  = workbook_new("test_defined_name01.xlsx");
    lxw_worksheet *worksheet1 = workbook_add_worksheet(workbook, NULL);
    lxw_worksheet *worksheet2 = workbook_add_worksheet(workbook, NULL);
    lxw_worksheet *worksheet3 = workbook_add_worksheet(workbook, "Sheet 3");

    worksheet_set_paper(worksheet1, 9);
    worksheet1->vertical_dpi = 200;

    worksheet_print_area(worksheet1, RANGE("A1:E6"));
    worksheet_autofilter(worksheet1, RANGE("F1:G1"));
    worksheet_write_string(worksheet1, CELL("G1"), "Filter", NULL);
    worksheet_write_string(worksheet1, CELL("F1"), "Auto", NULL);
    worksheet_fit_to_pages(worksheet1, 2, 2);

    workbook_define_name(workbook, "'Sheet 3'!Bar", "='Sheet 3'!$A$1");
    workbook_define_name(workbook, "Abc",           "=Sheet1!$A$1");
    workbook_define_name(workbook, "Baz",           "=0.98");
    workbook_define_name(workbook, "Sheet1!Bar",    "=Sheet1!$A$1");
    workbook_define_name(workbook, "Sheet2!Bar",    "=Sheet2!$A$1");
    workbook_define_name(workbook, "Sheet2!aaa",    "=Sheet2!$A$1");
    workbook_define_name(workbook, "_Egg",          "=Sheet1!$A$1");
    workbook_define_name(workbook, "_Fog",          "=Sheet1!$A$1");

    (void)worksheet2;
    (void)worksheet3;

    return workbook_close(workbook);
}
Ejemplo n.º 3
0
int main() {

    lxw_workbook  *workbook  = new_workbook("test_format02.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    lxw_format    *format1    = workbook_add_format(workbook);
    lxw_format    *format2    = workbook_add_format(workbook);

    worksheet_set_row(worksheet, 0, 30, NULL, NULL);

    format_set_font_name(format1, "Arial");
    format_set_bold(format1);
    format_set_align(format1, LXW_ALIGN_LEFT);
    format_set_align(format1, LXW_ALIGN_VERTICAL_BOTTOM);

    format_set_font_name(format2, "Arial");
    format_set_bold(format2);
    format_set_rotation(format2, 90);
    format_set_align(format2, LXW_ALIGN_CENTER);
    format_set_align(format2, LXW_ALIGN_VERTICAL_BOTTOM);

    worksheet_write_string(worksheet, 0, 0, "Foo", format1);
    worksheet_write_string(worksheet, 0, 1, "Bar", format2);

    return workbook_close(workbook);
}
Ejemplo n.º 4
0
int main() {

    lxw_workbook  *workbook = workbook_new("defined_name.xlsx");
    lxw_worksheet *worksheet;

    /* We don't use the returned worksheets in this example and use a generic
     * loop instead. */
    workbook_add_worksheet(workbook, NULL);
    workbook_add_worksheet(workbook, NULL);

    /* Define some global/workbook names. */
    workbook_define_name(workbook, "Sales", "=!G1:H10");

    workbook_define_name(workbook, "Exchange_rate", "=0.96");
    workbook_define_name(workbook, "Sales",         "=Sheet1!$G$1:$H$10");

    /* Define a local/worksheet name. */
    workbook_define_name(workbook, "Sheet2!Sales",  "=Sheet2!$G$1:$G$10");

    /* Write some text to the worksheets and one of the defined name in a formula. */
    LXW_FOREACH_WORKSHEET(worksheet, workbook){
        worksheet_set_column(worksheet, 0, 0, 45, NULL);

        worksheet_write_string(worksheet, 0, 0,
                               "This worksheet contains some defined names.", NULL);

        worksheet_write_string(worksheet, 1, 0,
                               "See Formulas -> Name Manager above.", NULL);

        worksheet_write_string(worksheet, 2, 0,
                               "Example formula in cell B3 ->", NULL);

        worksheet_write_formula(worksheet, 2, 1, "=Exchange_rate", NULL);
    }
Ejemplo n.º 5
0
int main() {

    /* Create a new workbook. */
    lxw_workbook  *workbook   = workbook_new("anatomy.xlsx");

    /* Add a worksheet with a user defined sheet name. */
    lxw_worksheet *worksheet1 = workbook_add_worksheet(workbook, "Demo");

    /* Add a worksheet with Excel's default sheet name: Sheet2. */
    lxw_worksheet *worksheet2 = workbook_add_worksheet(workbook, NULL);

    /* Add some cell formats. */
    lxw_format  *myformat1    = workbook_add_format(workbook);
    lxw_format  *myformat2    = workbook_add_format(workbook);

    /* Set the bold property for the first format. */
    format_set_bold(myformat1);

    /* Set a number format for the second format. */
    format_set_num_format(myformat2, "$#,##0.00");

    /* Widen the first column to make the text clearer. */
    worksheet_set_column(worksheet1, 0, 0, 20, NULL);

    /* Write some unformatted data. */
    worksheet_write_string(worksheet1, 0, 0, "Peach", NULL);
    worksheet_write_string(worksheet1, 1, 0, "Plum",  NULL);

    /* Write formatted data. */
    worksheet_write_string(worksheet1, 2, 0, "Pear",  myformat1);

    /* Formats can be reused. */
    worksheet_write_string(worksheet1, 3, 0, "Persimmon",  myformat1);


    /* Write some numbers. */
    worksheet_write_number(worksheet1, 5, 0, 123,       NULL);
    worksheet_write_number(worksheet1, 6, 0, 4567.555,  myformat2);


    /* Write to the second worksheet. */
    worksheet_write_string(worksheet2, 0, 0, "Some text", myformat1);


    /* Close the workbook, save the file and free any memory. */
    uint8_t error = workbook_close(workbook);

    /* Check if there was any error creating the xlsx file. */
    if (error)
        printf("Error in workbook_close().\n"
               "Error %d = %s\n", error, lxw_strerror(error));

    return error;
}
Ejemplo n.º 6
0
/*
 * Write some data to the worksheet.
 */
void write_worksheet_data(lxw_worksheet *worksheet, lxw_format *bold) {

    worksheet_write_string(worksheet, CELL("A1"), "Category", bold);
    worksheet_write_string(worksheet, CELL("A2"), "Apple",    NULL);
    worksheet_write_string(worksheet, CELL("A3"), "Cherry",   NULL);
    worksheet_write_string(worksheet, CELL("A4"), "Pecan",    NULL);

    worksheet_write_string(worksheet, CELL("B1"), "Values",   bold);
    worksheet_write_number(worksheet, CELL("B2"), 60,         NULL);
    worksheet_write_number(worksheet, CELL("B3"), 30,         NULL);
    worksheet_write_number(worksheet, CELL("B4"), 10,         NULL);
}
Ejemplo n.º 7
0
int main() {

    lxw_workbook  *workbook  = workbook_new("test_default_row01.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_set_default_row(worksheet, 24, LXW_FALSE);

    worksheet_write_string(worksheet, CELL("A1"), "Foo" , NULL);
    worksheet_write_string(worksheet, CELL("A10"), "Bar" , NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 8
0
int main() {

    lxw_workbook_options options = {1, NULL};

    lxw_workbook  *workbook  = workbook_new_opt("test_optimize21.xlsx", &options);
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_write_string(worksheet, CELL("A1"), "Foo",     NULL);
    worksheet_write_string(worksheet, CELL("C3"), " Foo",    NULL);
    worksheet_write_string(worksheet, CELL("E5"), "Foo ",    NULL);
    worksheet_write_string(worksheet, CELL("A7"), "\tFoo\t", NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 9
0
int main() {

    lxw_workbook_options options = {1, NULL};

    lxw_workbook  *workbook  = workbook_new_opt("test_optimize02.xlsx", &options);
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_write_string(worksheet, 0, 0, "Hello", NULL);
    worksheet_write_number(worksheet, 1, 0, 123,     NULL);

    /* G1 should be ignored since a later row has already been written. */
    worksheet_write_string(worksheet, CELL("G1"), "World", NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 10
0
int main() {

    lxw_workbook_options options = {1};

    lxw_workbook  *workbook  = workbook_new_opt("test_optimize01.xlsx", &options);
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_write_string(worksheet, 0, 0, "Hello", NULL);
    /* For testing overwrite the 0, 0 cell to ensure the original is freed. */
    worksheet_write_string(worksheet, 0, 0, "Hello", NULL);

    worksheet_write_number(worksheet, 1, 0, 123,     NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 11
0
int main() {

    lxw_workbook  *workbook  = workbook_new("test_default_row02.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
    uint8_t row;

    worksheet_set_default_row(worksheet, 15, LXW_TRUE);

    worksheet_write_string(worksheet, CELL("A1"), "Foo" , NULL);
    worksheet_write_string(worksheet, CELL("A10"), "Bar" , NULL);

    for (row = 1; row <= 8; row++)
        worksheet_set_row(worksheet, row, 15, NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 12
0
int main() {

    lxw_workbook  *workbook   = new_workbook("test_chart_bar02.xlsx");
    lxw_worksheet *worksheet1 = workbook_add_worksheet(workbook, NULL);
    lxw_worksheet *worksheet2 = workbook_add_worksheet(workbook, NULL);
    lxw_chart     *chart      = workbook_add_chart(workbook, LXW_CHART_BAR);

    /* For testing, copy the randomly generated axis ids in the target file. */
    chart->axis_id_1 = 93218304;
    chart->axis_id_2 = 93219840;

    uint8_t data[5][3] = {
        {1, 2,  3},
        {2, 4,  6},
        {3, 6,  9},
        {4, 8,  12},
        {5, 10, 15}
    };

    int row, col;
    for (row = 0; row < 5; row++)
        for (col = 0; col < 3; col++)
            worksheet_write_number(worksheet2, row, col, data[row][col] , NULL);

    worksheet_write_string(worksheet1, CELL("A1"), "Foo" , NULL);

    chart_add_series(chart, "Sheet2!$A$1:$A$5", "Sheet2!$B$1:$B$5");
    chart_add_series(chart, "Sheet2!$A$1:$A$5", "Sheet2!$C$1:$C$5");


    worksheet_insert_chart(worksheet2, CELL("E9"), chart);

    return workbook_close(workbook);
}
Ejemplo n.º 13
0
int main() {

    lxw_workbook  *workbook  = workbook_new("utf8.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_write_string(worksheet, 2, 1, "Это фраза на русском!", NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 14
0
int main() {

    lxw_workbook  *workbook  = workbook_new("test_data01.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_write_string(worksheet, 0, 0, "Hello", NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 15
0
int main() {

    lxw_workbook  *workbook  = workbook_new("test_simple01.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_write_string(worksheet, 0, 0, "Hello", NULL);
    worksheet_write_number(worksheet, 1, 0, 123,     NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 16
0
int main() {

    lxw_workbook  *workbook  = new_workbook("test_chart_bar22.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
    lxw_chart     *chart     = workbook_add_chart(workbook, LXW_CHART_BAR);

    /* For testing, copy the randomly generated axis ids in the target file. */
    chart->axis_id_1 = 43706240;
    chart->axis_id_2 = 43727104;


    worksheet_write_string(worksheet, 0, 1, "Series 1", NULL);
    worksheet_write_string(worksheet, 0, 2, "Series 2", NULL);
    worksheet_write_string(worksheet, 0, 3, "Series 3", NULL);

    worksheet_write_string(worksheet, 1, 0, "Category 1", NULL);
    worksheet_write_string(worksheet, 2, 0, "Category 2", NULL);
    worksheet_write_string(worksheet, 3, 0, "Category 3", NULL);
    worksheet_write_string(worksheet, 4, 0, "Category 4", NULL);

    worksheet_write_number(worksheet, 1, 1, 4.3, NULL);
    worksheet_write_number(worksheet, 2, 1, 2.5, NULL);
    worksheet_write_number(worksheet, 3, 1, 3.5, NULL);
    worksheet_write_number(worksheet, 4, 1, 4.5, NULL);

    worksheet_write_number(worksheet, 1, 2, 2.4, NULL);
    worksheet_write_number(worksheet, 2, 2, 4.5, NULL);
    worksheet_write_number(worksheet, 3, 2, 1.8, NULL);
    worksheet_write_number(worksheet, 4, 2, 2.8, NULL);

    worksheet_write_number(worksheet, 1, 3, 2,   NULL);
    worksheet_write_number(worksheet, 2, 3, 2,   NULL);
    worksheet_write_number(worksheet, 3, 3, 3,   NULL);
    worksheet_write_number(worksheet, 4, 3, 5,   NULL);

    worksheet_set_column(worksheet, COLS("A:D"), 11, NULL);

    chart_add_series(chart,
         "=Sheet1!$A$2:$A$5",
         "=Sheet1!$B$2:$B$5"
    );

    chart_add_series(chart,
         "=Sheet1!$A$2:$A$5",
         "=Sheet1!$C$2:$C$5"
    );

    chart_add_series(chart,
         "=Sheet1!$A$2:$A$5",
         "=Sheet1!$D$2:$D$5"
    );

    worksheet_insert_chart(worksheet, CELL("E9"), chart);

    return workbook_close(workbook);
}
Ejemplo n.º 17
0
int main() {

    lxw_workbook  *workbook  = new_workbook("test_chart_str02.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
    lxw_chart     *chart     = workbook_add_chart(workbook, LXW_CHART_SCATTER);

    /* For testing, copy the randomly generated axis ids in the target file. */
    chart->axis_id_1 = 41671680;
    chart->axis_id_2 = 41669376;

    worksheet_write_number(worksheet, 0, 0, 1,     NULL);
    worksheet_write_number(worksheet, 1, 0, 2,     NULL);
    worksheet_write_string(worksheet, 2, 0, "Foo", NULL);
    worksheet_write_number(worksheet, 3, 0, 4,     NULL);
    worksheet_write_number(worksheet, 4, 0, 5,     NULL);

    worksheet_write_number(worksheet, 0, 1, 2,     NULL);
    worksheet_write_number(worksheet, 1, 1, 4,     NULL);
    worksheet_write_string(worksheet, 2, 1, "Bar", NULL);
    worksheet_write_number(worksheet, 3, 1, 8,     NULL);
    worksheet_write_number(worksheet, 4, 1, 10,    NULL);

    worksheet_write_number(worksheet, 0, 2, 3,     NULL);
    worksheet_write_number(worksheet, 1, 2, 6,     NULL);
    worksheet_write_string(worksheet, 2, 2, "Baz", NULL);
    worksheet_write_number(worksheet, 3, 2, 12,    NULL);
    worksheet_write_number(worksheet, 4, 2, 15,    NULL);

    chart_add_series(chart,
         "=Sheet1!$A$1:$A$5",
         "=Sheet1!$B$1:$B$5"
    );

    chart_add_series(chart,
         "=Sheet1!$A$1:$A$5",
         "=Sheet1!$C$1:$C$5"
    );
    worksheet_insert_chart(worksheet, CELL("E9"), chart);

    return workbook_close(workbook);
}
Ejemplo n.º 18
0
int main() {

    lxw_workbook_options options = {1, NULL};

    /* Use deprecated constructor for testing. */
    lxw_workbook  *workbook  = new_workbook_opt("test_optimize26.xlsx", &options);
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_write_string(worksheet, 2, 2, "café", NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 19
0
int main() {

    lxw_workbook  *workbook  = new_workbook("test_simple02.xlsx");
    lxw_worksheet *worksheet1 = workbook_add_worksheet(workbook, NULL);
    lxw_worksheet *worksheet2 = workbook_add_worksheet(workbook, "Data Sheet");
    lxw_worksheet *worksheet3 = workbook_add_worksheet(workbook, NULL);

    lxw_format    *format     = workbook_add_format(workbook);
    format_set_bold(format);

    worksheet_write_string(worksheet1, 0, 0, "Foo", NULL);
    worksheet_write_number(worksheet1, 1, 0, 123, NULL);

    worksheet_write_string(worksheet3, 1, 1, "Foo", NULL);
    worksheet_write_string(worksheet3, 2, 1, "Bar", format);
    worksheet_write_number(worksheet3, 3, 2, 234, NULL);

    (void)worksheet2; /* Unused. For testing only. */

    return workbook_close(workbook);
}
Ejemplo n.º 20
0
/*
 * Write some data to the worksheet.
 */
void write_worksheet_data(lxw_worksheet *worksheet, lxw_format *bold) {

    int row, col;
    uint8_t data[6][3] = {
        /* Three columns of data. */
        {2, 10, 30},
        {3, 40, 60},
        {4, 50, 70},
        {5, 20, 50},
        {6, 10, 40},
        {7, 50, 30}
    };

    worksheet_write_string(worksheet, CELL("A1"), "Number",  bold);
    worksheet_write_string(worksheet, CELL("B1"), "Batch 1", bold);
    worksheet_write_string(worksheet, CELL("C1"), "Batch 2", bold);

    for (row = 0; row < 6; row++)
        for (col = 0; col < 3; col++)
            worksheet_write_number(worksheet, row + 1, col, data[row][col] , NULL);
}
Ejemplo n.º 21
0
int main() {

    lxw_workbook_options options = {LXW_FALSE, "."};

    lxw_workbook  *workbook  = workbook_new_opt("test_tmpdir01.xlsx", &options);
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_write_string(worksheet, 0, 0, "Hello", NULL);
    worksheet_write_number(worksheet, 1, 0, 123,     NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 22
0
int main() {

    lxw_workbook  *workbook  = workbook_new("test_fit_to_pages05.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_fit_to_pages(worksheet, 1, 0);
    worksheet_set_paper(worksheet, 9);
    worksheet->vertical_dpi = 200;

    worksheet_write_string(worksheet, CELL("A1"), "Foo" , NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 23
0
int main() {

    lxw_workbook  *workbook  = new_workbook("test_rich_string04.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    lxw_format *bold = workbook_add_format(workbook);
    lxw_format *italic = workbook_add_format(workbook);

    format_set_bold(bold);
    format_set_italic(italic);

    worksheet_write_string(worksheet, CELL("A1"), "Foo", bold);
    worksheet_write_string(worksheet, CELL("A2"), "Bar", italic);

    lxw_rich_string_tuple fragment1 = {.format = bold,   .string = "abc"};
    lxw_rich_string_tuple fragment2 = {.format = italic, .string = "defg"};

    lxw_rich_string_tuple *rich_strings[] = {&fragment1, &fragment2, NULL};
    worksheet_write_rich_string(worksheet, CELL("A3"), rich_strings, NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 24
0
int main() {

    lxw_workbook  *workbook  = new_workbook("test_print_area05.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_set_paper(worksheet, 9);
    worksheet->vertical_dpi = 200;

    worksheet_print_area(worksheet, RANGE("A1:A1048576"));

    worksheet_write_string(worksheet, CELL("A1"), "Foo" , NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 25
0
int main() {

    /* Create a workbook and add a worksheet. */
    lxw_workbook  *workbook  = new_workbook("tutorial01.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    /* Start from the first cell. Rows and columns are zero indexed. */
    int row = 0;
    int col = 0;

    /* Iterate over the data and write it out element by element. */
    for (row = 0; row < 4; row++) {
        worksheet_write_string(worksheet, row, col,     expenses[row].item, NULL);
        worksheet_write_number(worksheet, row, col + 1, expenses[row].cost, NULL);
    }

    /* Write a total using a formula. */
    worksheet_write_string (worksheet, row, col,     "Total",       NULL);
    worksheet_write_formula(worksheet, row, col + 1, "=SUM(B1:B4)", NULL);

    /* Save the workbook and free any allocated memory. */
    return workbook_close(workbook);
}
Ejemplo n.º 26
0
int main() {

    lxw_workbook  *workbook  = new_workbook("test_repeat04.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, "Sheet 1");

    worksheet_set_paper(worksheet, 9);
    worksheet->vertical_dpi = 200;

    worksheet_repeat_rows(worksheet, 0, 0);

    worksheet_write_string(worksheet, CELL("A1"), "Foo" , NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 27
0
int main() {

    lxw_workbook  *workbook  = workbook_new("test_gridlines01.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_set_paper(worksheet, 9);
    worksheet->vertical_dpi = 200;

    worksheet_gridlines(worksheet, LXW_HIDE_ALL_GRIDLINES);

    worksheet_write_string(worksheet, CELL("A1"), "Foo" , NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 28
0
int main() {

    lxw_workbook  *workbook  = workbook_new("test_print_options02.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_set_paper(worksheet, 9);
    worksheet->vertical_dpi = 200;

    worksheet_center_horizontally(worksheet);

    worksheet_write_string(worksheet, CELL("A1"), "Foo" , NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 29
0
int main() {

    lxw_workbook  *workbook  = workbook_new("test_row_col_format18.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    lxw_format    *bold      = workbook_add_format(workbook);
    format_set_bold(bold);

    worksheet_set_row(worksheet, 1048575, 15, bold);

    worksheet_write_string(worksheet, 1048575, 0, "Bar", NULL);

    return workbook_close(workbook);
}
Ejemplo n.º 30
0
int main() {

    lxw_workbook  *workbook  = workbook_new("test_print_options06.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    worksheet_set_paper(worksheet, 9);
    worksheet->vertical_dpi = 200;

    worksheet_print_area(worksheet, RANGE("A1:G20"));
    worksheet_repeat_rows(worksheet, 0, 0);

    worksheet_write_string(worksheet, CELL("A1"), "Foo" , NULL);

    return workbook_close(workbook);
}