You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by bhames50 <bh...@govsg.com> on 2015/01/19 16:28:44 UTC

Resubmit to application when user clicks on "Enable Editing"

I have written code using Apache POI to create an Excel spreadsheet, and it
appears to create the spreadsheet fine. But, when the user clicks on "Enable
Editing", the spreadsheet does another submit to my application, and since
it is in another session, my application rejects the request, and I end up
with a blank spreadsheet.

It only happens when the user "opens" the spreadsheet, and then clicks on
"Enable Editing". I realize why it is coming up in protected mode as the
spreadsheet was built in a temporary internet file, and that is regarded as
an "unsafe" place. What I don't understand is why the submit happens when
the user clicks on "Enable Editing".

Is there a way in POI to handle this, or if not, to turn off the "Open"
button making the user save the spreadsheet before viewing it?

I know that the protected mode can be turned off in Excel, but my users are
using computers with VERY restricted policies, and this is not an option for
them. I'm using Spring MVC by the way, and the Excel spreadsheet is
submitting back to my controller.



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Resubmit-to-application-when-user-clicks-on-Enable-Editing-tp5717689.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Resubmit to application when user clicks on "Enable Editing"

Posted by kiwiwings <ki...@apache.org>.
Hi,

have you played around with the content disposition header? (i.e. setting it
to "attachment")

http://stackoverflow.com/questions/974079/setting-mime-type-for-excel-document?lq=1

Best wishes,
Andi



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Resubmit-to-application-when-user-clicks-on-Enable-Editing-tp5717689p5717712.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Resubmit to application when user clicks on "Enable Editing"

Posted by bhames50 <bh...@govsg.com>.
Dominik, 

Again, thanks for the reply! I'm going to take an alternate approach, and if
the user clicks on "Open", and then clicks on "Enable Editing", I'm going to
respond with a generated spreadsheet that tells them to "Close, and go back
and save the spreadsheet if you need to edit".

Thanks!



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Resubmit-to-application-when-user-clicks-on-Enable-Editing-tp5717689p5717711.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Resubmit to application when user clicks on "Enable Editing"

Posted by Dominik Stadler <do...@gmx.at>.
Hi,

I am not an expert in that area, but maybe you can set the MediaType
of your download to some binary form, not "excel", then the browser
usually just offers to download the file, not to open it.

Dominik.

On Tue, Jan 20, 2015 at 4:04 PM, bhames50 <bh...@govsg.com> wrote:
> Dominik,
>
> Thanks for the reply! You confirmed my what I thought, but it's always nice
> to have someone confirm it.
>
> You mentioned in your reply to force the user to first save the file
> locally. Do you know if we have any control over the "Open/Save/Save As"
> dialog box? I felt like that was either a Windows or an Excel thing, and I
> wouldn't be able to do anything.
>
> What I would really like to do is disable the "Open" option, otherwise I'm
> going to have users clicking on it.
>
>
>
> --
> View this message in context: http://apache-poi.1045710.n5.nabble.com/Resubmit-to-application-when-user-clicks-on-Enable-Editing-tp5717689p5717706.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Resubmit to application when user clicks on "Enable Editing"

Posted by bhames50 <bh...@govsg.com>.
Dominik,

Thanks for the reply! You confirmed my what I thought, but it's always nice
to have someone confirm it.

You mentioned in your reply to force the user to first save the file
locally. Do you know if we have any control over the "Open/Save/Save As"
dialog box? I felt like that was either a Windows or an Excel thing, and I
wouldn't be able to do anything.

What I would really like to do is disable the "Open" option, otherwise I'm
going to have users clicking on it.



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Resubmit-to-application-when-user-clicks-on-Enable-Editing-tp5717689p5717706.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Resubmit to application when user clicks on "Enable Editing"

Posted by Dominik Stadler <do...@gmx.at>.
Hi,

I don't think there is a way that would allow to control this from
POI, it actually would render the whole "enable editing" feature of
Excel useless if you could build the document in a way to prevent it.

Also doing another request upon "enable editing" is likely built into
Excel as part of mandatary locking in Windows as it will only open the
file read-only and thus theoretically some other user might have
changed it in the meantime.

The only thing I can imagine would be to force the user to first save
the file locally when it is fetched from your application, then the
open/re-open of the local file will not trigger a re-download.

Dominik.

On Mon, Jan 19, 2015 at 4:28 PM, bhames50 <bh...@govsg.com> wrote:
> I have written code using Apache POI to create an Excel spreadsheet, and it
> appears to create the spreadsheet fine. But, when the user clicks on "Enable
> Editing", the spreadsheet does another submit to my application, and since
> it is in another session, my application rejects the request, and I end up
> with a blank spreadsheet.
>
> It only happens when the user "opens" the spreadsheet, and then clicks on
> "Enable Editing". I realize why it is coming up in protected mode as the
> spreadsheet was built in a temporary internet file, and that is regarded as
> an "unsafe" place. What I don't understand is why the submit happens when
> the user clicks on "Enable Editing".
>
> Is there a way in POI to handle this, or if not, to turn off the "Open"
> button making the user save the spreadsheet before viewing it?
>
> I know that the protected mode can be turned off in Excel, but my users are
> using computers with VERY restricted policies, and this is not an option for
> them. I'm using Spring MVC by the way, and the Excel spreadsheet is
> submitting back to my controller.
>
>
>
> --
> View this message in context: http://apache-poi.1045710.n5.nabble.com/Resubmit-to-application-when-user-clicks-on-Enable-Editing-tp5717689.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org