title: Unable to get text wrapping or vertical centering to work with xlsxwriter
body: <p>I'm working with a set of dataframes in Pandas. When printing these dataframes to a .xlsx file, I'm printing each dataframe to a different tab. I'm using xlsxwriter to format the worksheets before saving. I'm running into trouble when I try to do anything other than align the cells to 'center'. The script has no issue with setting column width or row height. I cannot get text wrapping or vertical centering to work.</p>
  
  <p>I have tried using the following code, but it never wraps the text in the saved or vertically centers in the .xlsx file. It does nothing.</p>
  
  <pre><code>cell_format2.set_text_wrap()
  cell_format2.set_align('center')
  cell_format2.set_align('vcenter')
  </code></pre>
  
  <p>I have also tried to do the formatting in the add_format function as follows:</p>
  
  <pre><code>cell_format2 = workbook.add_format({'text_wrap': True, 'valign': True})
  </code></pre>
  
  <p>Using the add_format function always gives me the following error:</p>
  
  <p><code>AttributeError: 'bool' object has no attribute 'lower'</code></p>
  
  <p>Here's my code where I'm printing 3 dataframes to 3 separate tabs with xlsxwriter</p>
  
  <pre><code># Create a Pandas Excel writer using XlsxWriter as the engine.
  writer = pd.ExcelWriter(r'Ashland_Detailed_MTO.xlsx', engine='xlsxwriter')
  # Write each dataframe to a different worksheet.
  df1.to_excel(writer, index=None, header=True, sheet_name='List A')
  df3.to_excel(writer, index=None, header=True, sheet_name='List B')
  df5.to_excel(writer, index=None, header=True, sheet_name='List C')
  
  workbook = writer.book
  cell_format = workbook.add_format()
  cell_format.set_align('center')
  cell_format2 = workbook.add_format()
  cell_format2.set_text_wrap()
  cell_format2.set_align('center')
  
  worksheet = writer.sheets['List A']
  worksheet.freeze_panes(1, 0)
  worksheet.set_column('A:A', 35, cell_format)
  worksheet.set_column('B:B', 12, cell_format)
  worksheet.set_column('C:C', 6, cell_format)
  worksheet.set_column('D:D', 118, cell_format)
  worksheet.set_column('E:H', 7, cell_format)
  worksheet.set_column('I:J', 15, cell_format)
  worksheet.set_column('K:N', 10, cell_format)
  
  worksheet = writer.sheets['List B']
  worksheet.freeze_panes(1, 0)
  worksheet.set_column('A:G', 15, cell_format)
  
  worksheet = writer.sheets['List C']
  worksheet.set_row(0, 45, cell_format2)
  worksheet.freeze_panes(1, 0)
  worksheet.set_column('A:G', 12, cell_format)
  worksheet.set_column('H:H', 17, cell_format)
  worksheet.set_column('I:I', 26, cell_format)
  worksheet.set_column('J:J', 20, cell_format)
  worksheet.set_column('K:K', 57, cell_format)
  worksheet.set_column('L:L', 20, cell_format)
  worksheet.set_column('M:M', 57, cell_format)
  worksheet.set_column('N:N', 16, cell_format)
  worksheet.set_column('O:O', 20, cell_format)
  worksheet.set_column('P:AL', 13, cell_format)
  worksheet.set_column('AM:AM', 40, cell_format)
  writer.save()
  </code></pre>
  
  <p>Each time I open the saved .xlsx file, the formatting is as shown below (1st image). I am wanting it to format as shown in the 2nd image.</p>
  
  <p><img src="https://i.imgur.com/NllHYsl.jpg" alt="image"></p>