grails excel export to server location only

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

grails excel export to server location only

jawad.bokhari
Hi, 

Grails export plugin is great for exporting data.

I actually have to send the data in an email when users opts to do so. I am trying to download the data in excel on the server and then attaching a file from the server for sending the email attachment. 

To put the exported file on the server, I am calling exportService as following:

exportService.export(params.format, outputStream,rateSheetEntryInstanceList, [:], [:])

where outputStream is an outputStream to a file created on the local server. The file is saved on the server nicely, but it's also donwloaded on the client side. 
I actually just want to prevent downloading of file on the client side. Any suggestions, how can I do that.


Thanks,
Jawad
Reply | Threaded
Open this post in threaded view
|

Re: grails excel export to server location only

Nathan Wells
The line of code you provide will only write the export to the 'outputStream' object. Is there more code you can share so that we can have more context? The only way I can think of what you're saying happening is if either 'outputStream' writes to both the file and response, or if you are somewhere making another call to exportService.export.

Nathan Wells


On Tue, Nov 20, 2012 at 8:30 AM, Jawad Bokhari <[hidden email]> wrote:
Hi, 

Grails export plugin is great for exporting data.

I actually have to send the data in an email when users opts to do so. I am trying to download the data in excel on the server and then attaching a file from the server for sending the email attachment. 

To put the exported file on the server, I am calling exportService as following:

exportService.export(params.format, outputStream,rateSheetEntryInstanceList, [:], [:])

where outputStream is an outputStream to a file created on the local server. The file is saved on the server nicely, but it's also donwloaded on the client side. 
I actually just want to prevent downloading of file on the client side. Any suggestions, how can I do that.


Thanks,
Jawad

Reply | Threaded
Open this post in threaded view
|

Re: grails excel export to server location only

jawad.bokhari
Thanks Nathan,

I figured it out. 

Actually, I just had to remove following 2 lines that were setting the header for exporting the file to the client side.

response.contentType = grailsApplication.config.grails.mime.types[params.format] response.setHeader("Content-disposition", "attachment; filename=books.${params.extension}")


Thanks again,

Jawad


On Wed, Nov 21, 2012 at 12:27 AM, Nathan Wells <[hidden email]> wrote:
The line of code you provide will only write the export to the 'outputStream' object. Is there more code you can share so that we can have more context? The only way I can think of what you're saying happening is if either 'outputStream' writes to both the file and response, or if you are somewhere making another call to exportService.export.

Nathan Wells



On Tue, Nov 20, 2012 at 8:30 AM, Jawad Bokhari <[hidden email]> wrote:
Hi, 

Grails export plugin is great for exporting data.

I actually have to send the data in an email when users opts to do so. I am trying to download the data in excel on the server and then attaching a file from the server for sending the email attachment. 

To put the exported file on the server, I am calling exportService as following:

exportService.export(params.format, outputStream,rateSheetEntryInstanceList, [:], [:])

where outputStream is an outputStream to a file created on the local server. The file is saved on the server nicely, but it's also donwloaded on the client side. 
I actually just want to prevent downloading of file on the client side. Any suggestions, how can I do that.


Thanks,
Jawad




--
regards,
Jawad Bokhari