Closed ghost closed 3 years ago
@petervandeput My memory is a bit rusty here, but I think there is no way to force a browser into using the disposition. Can you use the developer tools to make sure the header is coming through in the request?
it does turbolinks.self-569ee74eaa15c1e2019317ff770b8769b1ec033a0f572a485f64c82ddc8f989e.js?body=1:6 Resource interpreted as Document but transferred with MIME type application/xlsx: "http://localhost:3000/admin/my_reports/2".
Content-Transfer-Encoding: binary Content-Type: application/vnd.ms-excel
It should be "Content-Disposition: inline". Are you saying that it is there?
You could manually set it as well:
response.headers['Content-Disposition'] = 'inline'
or
response.headers['Content-Disposition'] = 'inline; filename="my_new_filename.xlsx"'
before your render statement.
What version of rails, caxlsx, and caxlsx_rails are you using?
Note if you use the response.headers statement you'll want to pass the disposition to render as well.
sorry but didn't work
@petervandeput Did you ever have any luck with this?
in gem file
In controller
The report is generated correctly BUT it is downloaded instead of rendered in browser (Chrome)