簡體   English   中英

使用axlsx gem如何在橫向方向上生成卓越

[英]using axlsx gem how to generate excel in landscape orientation

我在滑軌中使用axlsx gem,並且需要在橫向方向上產生出色的效果

wb = xlsx_package.workbook
wb.add_worksheet(name: "Semestre") do |sheet|
sheet.add_row ["Período", "Turma", "Sala", "Disciplina", "Tipo", "Híbrida", "Dia da Semana", "Hora Inicial", "Hora Final", "CH", "Curso", "Professor", "Matrícula"]

  @oferta.each do |oferta|

if oferta.sala_id != nil 
  sala=oferta.sala.nome 
else 
  sala="-" 
end
sheet.add_row [oferta.periodo, oferta.codturma, sala, oferta.disciplinaturma.disciplina.nome, oferta.tipoaula, oferta.disciplinaturma.disciplina.hibrida, oferta.diasemana, oferta.horainicial.try(:strftime, ("%H:%M")), oferta.horafinal.try(:strftime, ("%H:%M")), oferta.cargahoraria.to_s+" h", oferta.disciplinaturma.turma.curso.nome, oferta.professor.nome, oferta.professor.matricula]

結束

你檢查過這個文件了

wb = Axlsx :: Package.new.workbook

在創建工作表時使用選項。

ws = wb.add_worksheet:page_setup => {:fit_to_width => 2,:orientation =>:landscape}

文檔還可以幫助您

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM