This commit is contained in:
BoHung Chiu 2022-02-09 16:04:34 +08:00
parent cdb18dafd8
commit c9d670f796
2 changed files with 5 additions and 3 deletions

View File

@ -1,7 +1,8 @@
# encoding: utf-8 # encoding: utf-8
wb = xlsx_package.workbook wb = xlsx_package.workbook
wb.add_worksheet(name: "school_class") do |sheet| wb.add_worksheet(name: "cancer_tool") do |sheet|
if !@results[0].nil?
row = [] row = []
title = sheet.styles.add_style(:bg_color => "FFFF00",:border=>{ :style => :thin, :color => "666666" },:alignment=>{ :horizontal => :center,:vertical => :center ,:wrap_text => true}) title = sheet.styles.add_style(:bg_color => "FFFF00",:border=>{ :style => :thin, :color => "666666" },:alignment=>{ :horizontal => :center,:vertical => :center ,:wrap_text => true})
column = sheet.styles.add_style(:alignment=>{ :horizontal => :center,:vertical => :center ,:wrap_text => true},:border=>{ :style => :thin, :color => "666666" }) column = sheet.styles.add_style(:alignment=>{ :horizontal => :center,:vertical => :center ,:wrap_text => true},:border=>{ :style => :thin, :color => "666666" })
@ -34,3 +35,4 @@ wb.add_worksheet(name: "school_class") do |sheet|
sheet.add_row infos_row , :style=> column sheet.add_row infos_row , :style=> column
end end
end end
end

View File

@ -1,14 +1,13 @@
<link href="/assets/admin/cancerpredict.css" media="print" rel="stylesheet"> <link href="/assets/admin/cancerpredict.css" media="print" rel="stylesheet">
<link href="/assets/admin/cancerpredict.css" media="screen" rel="stylesheet"> <link href="/assets/admin/cancerpredict.css" media="screen" rel="stylesheet">
<% if !@results[0].nil? %>
<table> <table>
<thead> <thead>
<tr> <tr>
<% if !@results[0].nil? %>
<th><%=((I18n.locale=="en") ? 'submit time' : '提交時間') %></th> <th><%=((I18n.locale=="en") ? 'submit time' : '提交時間') %></th>
<% @results[0].names.each do |key,name|%> <% @results[0].names.each do |key,name|%>
<th><%=name[I18n.locale.to_s].to_s.html_safe %></th> <th><%=name[I18n.locale.to_s].to_s.html_safe %></th>
<%end%> <%end%>
<%end%>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -44,6 +43,7 @@
<%end%> <%end%>
</tbody> </tbody>
</table> </table>
<% end %>
<%=@pagination.html_safe%> <%=@pagination.html_safe%>
<style type="text/css"> <style type="text/css">
thead > tr > th{ thead > tr > th{