No Matches
<< tab_colors.c hide_sheet.c >>

Example of how to set a worksheet cell diagonal border.

* A simple formatting example that demonstrates how to add diagonal
* cell borders using the libxlsxwriter library.
* Copyright 2014-2021, John McNamara,
#include "xlsxwriter.h"
int main() {
/* Create a new workbook and add a worksheet. */
lxw_workbook *workbook = workbook_new("diagonal_border.xlsx");
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
/* Add some diagonal border formats. */
lxw_format *format1 = workbook_add_format(workbook);
lxw_format *format2 = workbook_add_format(workbook);
lxw_format *format3 = workbook_add_format(workbook);
lxw_format *format4 = workbook_add_format(workbook);
worksheet_write_string(worksheet, CELL("B3"), "Text", format1);
worksheet_write_string(worksheet, CELL("B6"), "Text", format2);
worksheet_write_string(worksheet, CELL("B9"), "Text", format3);
worksheet_write_string(worksheet, CELL("B12"), "Text", format4);
return 0;
void format_set_diag_type(lxw_format *format, uint8_t type)
Set the diagonal cell border type.
Definition: format.h:314
void format_set_diag_border(lxw_format *format, uint8_t style)
Set the diagonal cell border style.
Definition: format.h:218
void format_set_diag_color(lxw_format *format, lxw_color_t color)
Set the diagonal cell border color.
Definition: format.h:170
Definition: format.h:173
Definition: format.h:176
Struct to represent the formatting properties of an Excel format.
Definition: format.h:359
Struct to represent an Excel workbook.
Definition: workbook.h:293
Struct to represent an Excel worksheet.
Definition: worksheet.h:2108
#define CELL(cell)
Convert an Excel A1 cell string into a (row, col) pair.
Definition: utility.h:46
lxw_workbook * workbook_new(const char *filename)
Create a new workbook object.
lxw_format * workbook_add_format(lxw_workbook *workbook)
Create a new Format object to formats cells in worksheets.
lxw_error workbook_close(lxw_workbook *workbook)
Close the Workbook object and write the XLSX file.
lxw_worksheet * workbook_add_worksheet(lxw_workbook *workbook, const char *sheetname)
Add a new worksheet to a workbook.
lxw_error worksheet_write_string(lxw_worksheet *worksheet, lxw_row_t row, lxw_col_t col, const char *string, lxw_format *format)
Write a string to a worksheet cell.