def to_xlsx(layout, output_fp, orientation='vertical', **kwargs):
'''
Take a layout which contains a list of presentation models builts using the build_presentation_model function.
Args:
layout: An nested list of presentation_models, examples: [presentation_model] or [presentation_model1, presentation_mode2] etc
output_fp: the xlsx file name
orientation: if vertical, the top level presentation model elements are rendered vertically, and for every nested level the orientation is flipped.
if horizontal, then the behavior is inverse
kwargs:
column-width: default=20, the default column width of all columns in the worksheet. Individual column width cannot be set currently
'''
row_col_dict = GridLayoutManager.get_row_col_dict(
layout, orientation=orientation)
wb = Workbook()
ws = wb.active
XLSXWriter._to_xlsx_worksheet(row_col_dict, ws, **kwargs)
wb.save(output_fp)
评论列表
文章目录