Project

General

Profile

Actions

Defect #29192

closed

why i haave a empty file with axlsx library?

Added by mor diop over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

with the axlsx library when I export data I get an empty file I do not know why? Ideas thank you

export_controller.rb

class ExportController < ApplicationController
def index
@attachments=Attachment.all
@projects=Project.all
respond_to do |format|
format.html
format.xlsx{render xlsx: 'export', filename: "export.xlsx"}
end
end
end

index.html.erb

<h1>Liste des projets</h1>
<%= link_to 'Download as .xlsx', export_path(format: "xlsx") %>

index.xlsx.axlsx

wb = xlsx_package.workbook
wb.add_worksheet(:name => "Attachments") do |sheet|
@attachments.each do |attachment|
sheet.add_row [attachment.id, attachment.filename]
end
end

wb.add_worksheet(name: "Projects") do |sheet|
@projects.each do |project|
sheet.add_row [project.id, project.name]
end
end

routes.rb

get '/export', to: 'export#index'

Environment:
Redmine version 3.1.1.stable
Ruby version 2.3.3-p222 (2016-11-21) [x86_64-linux-gnu]
Rails version 4.2.4
Environment development
Database adapter Mysql2
SCM:
Filesystem
Redmine plugins:
no plugin installed

Actions #1

Updated by Go MAEDA over 6 years ago

  • Status changed from New to Closed
  • Resolution set to Invalid

It is not a defect of Redmine core. Redmine does not have such a code. We don’t take care of third-party code.

Actions

Also available in: Atom PDF