File: diagonal_border.py

package info (click to toggle)
xlsxwriter 3.1.9-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 56,308 kB
  • sloc: python: 51,511; javascript: 7,768; sh: 284; makefile: 195; perl: 75
file content (31 lines) | stat: -rw-r--r-- 835 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
##############################################################################
#
# A simple formatting example that demonstrates how to add diagonal cell
# borders with XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright 2013-2023, John McNamara, jmcnamara@cpan.org
#
import xlsxwriter

workbook = xlsxwriter.Workbook("diag_border.xlsx")
worksheet = workbook.add_worksheet()

format1 = workbook.add_format({"diag_type": 1})
format2 = workbook.add_format({"diag_type": 2})
format3 = workbook.add_format({"diag_type": 3})

format4 = workbook.add_format(
    {
        "diag_type": 3,
        "diag_border": 7,
        "diag_color": "red",
    }
)

worksheet.write("B3", "Text", format1)
worksheet.write("B6", "Text", format2)
worksheet.write("B9", "Text", format3)
worksheet.write("B12", "Text", format4)

workbook.close()