セルの文字配置

2014/12/21

Python2.7.6,XlsxWriter0.6.4

format.set_align()で設定。


# -*- coding: utf-8 -*-

import xlsxwriter

def main():

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

    cell_format = workbook.add_format()
    cell_format.set_align('center')
    cell_format.set_align('bottom')

    worksheet.write(0,0,14.3246,cell_format)

    workbook.close()

if __name__ == '__main__':
    main()

Horizontal alignmentcenterrightfilljustifycenter_across
Vertical alignmenttopvcenterbottomvjustifyThe Format Class
https://xlsxwriter.readthedocs.org/format.html#format-set-align