|
- wb = xlsx_package.workbook
- wb.use_shared_strings = true
- wb.styles do |s|
- no_wrap_sz = s.add_style :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: false,:horizontal => :center,:vertical => :center }
- sz_all = s.add_style :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center }
- row_cell = s.add_style :bg_color=> "FAEBDC",:border => { :style => :thin, :color =>"000000" },alignment: {wrap_text: true,:horizontal => :center,:vertical => :center }
- blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center}
-
- #课堂信息摘要
- wb.add_worksheet(name:course_info[0]) do |sheet|
- sheet.sheet_view.show_grid_lines = false
- course_main_info = course_info[1]
- course_group_info = course_info[2]
- group_info_d = course_group_info[0]
- group_info_detail = course_group_info[1]
- course_main_info.each do |c|
- sheet.add_row c, :style => sz_all #用户id
- end
- sheet["A1:A7"].each { |c| c.style = row_cell }
- sheet.add_row [],:style => sz_all
- if group_info_detail.count > 0
- sheet.add_row group_info_d, :style => blue_cell
- group_info_detail.each do |group|
- sheet.add_row group, :style => sz_all #用户id
- end
- sheet.column_info.second.width = 40
- end
- end #add_worksheet
- end
|