
wb = xlsx_package.workbook
# wb.use_autowidth = false
wb.styles do |s|
  sz_all = s.add_style :sz => 10,:border => { :style => :thin, :color =>"000000"},:alignment => {wrap_text: true,:horizontal => :left}
  blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 20,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :left}

  wb.add_worksheet(:name => "统计结果") do |sheet|
    sheet.sheet_view.show_grid_lines = false
    sub_commit = polls_user_commit[:sub_commit]
    poll_user_info = polls_user_commit[:poll_users_info]
    user_commit = polls_user_commit[:user_commit]

    if sub_commit&.size > 0
      sub_commit.each do |sub|
        main_sub_title = sub[:sub_title]
        main_sub_content = sub[:sub_user_votes]
        sheet.add_row main_sub_title,:height =>15, :style => blue_cell
        if main_sub_content.present?
          main_sub_content.each do |con|
            sheet.add_row con,:height =>15, :style => sz_all
          end
        end
        sheet.add_row []
      end
    end

    sheet.add_row poll_user_info, :height =>15, :style => blue_cell

    if user_commit&.size > 0
      user_commit.each do |com|
        sheet.add_row com, :height =>15,:style => sz_all
      end
    end
    sheet.column_widths *([25]*sheet.column_info.count)
    sheet.column_info.first.width = 15

  end  #add_worksheet
end
