-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Excel export? #18
Comments
I am glad you've found WiceGrid of use to you. I haven't been active in developing the plugin lately due to lack of free time, But anyway, CSV generation is done via a very simple class This is a dead simple class. If you or anybody else could provide me with a class having a |
My hack, which is not making a special excel file but just present the csv as an excel file. def index
@grid = initialize_grid(
Product,
:enable_export_to_csv => true
)
if params[:grid] && params[:grid][:export] == "csv"
response.headers['Content-Disposition'] = "attachment; filename=\"productss.xls\""
response.headers['Content-Type'] = "application/vnd.ms-excel; charset=UTF8"
respond_to{ |format| format.csv }
else
respond_to{ |format| format.html }
end
end |
The change you are proposing is actually replacing 'text/csv' by 'application/vnd.ms-excel' ( https://github.com/leikind/wice_grid/blob/rails3/lib/wice_grid_controller.rb#L120), right? |
Yes exactly! if this was configurable you could also let one choose. |
Well, CSV files are always opened by a spreadsheet program, so this is not a revelation to me. I don't use Windows, but I saw WiceGrid used by my colleagues on Windows, and somehow their Excel opens files downloaded with the 'text/csv' MIME type. Anyway, I consider 'text/csv' to be the standard, and 'application/vnd.ms-excel' is Windows specific. I wouldn't mind such an option in export_grid_if_requested (https://github.com/leikind/wice_grid/blob/rails3/lib/wice_grid_controller.rb#L110). Are you interesting in forking the plugin and adding and documenting the feature? |
Yes, I would like to fork :), If you have users who don't want to now what CSV is. Or users who don't want to be bothered with the standard import wizard that excel displays when opening CSV files over and over again. I know it's just something small but our users need it. |
I might add a separate link for the Excel-type CSV just so my users arent confused by the import wizard. |
Add new option filter_control_options
I would like to not only have .csv export, but proper MS-Excel export as well, maybe by using the Ruby Spreadsheet gem in connection with Wice Grid? Thank you for the great Wice Grid, it really rocks, btw!
The text was updated successfully, but these errors were encountered: