1############################################################################## 2# 3# A simple formatting example using XlsxWriter. 4# 5# This program demonstrates the indentation cell format. 6# 7# Copyright 2013-2021, John McNamara, jmcnamara@cpan.org 8# 9import xlsxwriter 10 11workbook = xlsxwriter.Workbook('text_indent.xlsx') 12 13worksheet = workbook.add_worksheet() 14indent1 = workbook.add_format({'indent': 1}) 15indent2 = workbook.add_format({'indent': 2}) 16 17worksheet.set_column('A:A', 40) 18 19worksheet.write('A1', "This text is indented 1 level", indent1) 20worksheet.write('A2', "This text is indented 2 levels", indent2) 21 22workbook.close() 23