简体   繁体   中英

xlsxwriter - grouping via set_row()

I tried to set some groups in xlsxwriter but it seems I can't get the + Symbol at the top of my group. As it is setting the grouping row-wise I tried to write a function that takes the workbook, the worksheet index and a start/end as well as the level. But whatever I do the grouping symbol in excel never appears in the first row. Funny thing is, if I use something like start_row + 5 for the collapsing row I will get a second + at the right row, but still another one at the end. Does anyone know if its possible?

The examples show grouping just for the last row of a group.

def set_group(out_wb, ws_index, start_row, end_row, level):
  #added as i used an offset
  start_row = start_row
  end_row = end_row

  out_wb.worksheets()[ws_index].set_row(start_row, None, None, {'level': level, 'collapsed': True})
  for i in range(start_row + 1, end_row):
    out_wb.worksheets()[ws_index].set_row(i, None, None, {'level': level, 'hidden': True})


return out_wb

您可以使用outline_settings()工作表方法并将symbols_below设置为False

worksheet.outline_settings(symbols_below=False)

我在版本0.5.5使用xlsxwriter ,命令行是

worksheet.outline_settings(outline_below=False)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM