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('cell_indentation.xlsx') 12 13worksheet = workbook.add_worksheet() 14 15indent1 = workbook.add_format({'indent': 1}) 16indent2 = workbook.add_format({'indent': 2}) 17 18worksheet.set_column('A:A', 40) 19 20worksheet.write('A1', "This text is indented 1 level", indent1) 21worksheet.write('A2', "This text is indented 2 levels", indent2) 22 23workbook.close() 24