因此,我正在我的 rails 应用程序中设置 axlsx_rails 并遇到一个一致的问题,即下载的 xlsx 不显示任何非数字字符。它也不打印任何包含非数字字符(即“1p”)的单元格将是一个空白单元格。
这是 axlsx 文件中的文件:
wb = xlsx_package.workbook
wb.add_worksheet(name: "classes") do |sheet|
@student.classes.each do |class|
sheet.add_row [class.name, "1"]
end
sheet.add_row ["p", "2", "e", "3"]
end
控制器代码是
class App::Company::ReportsController < ApplicationController
include Concerns::UserRequirements
include Concerns::SchoolRequirements
skip_before_action :verify_authenticity_token
layout :false
def holders
@student = Student.find(params[:id])
render xlsx: "holders", template: "app/company/reports/holders.xlsx"
end
end
有谁知道可能是什么原因造成的?