0

I am using custom button in standard view page for generating word document. When i click on button, a new window is opening and document generated in that window. I don't want new window. How can i download the document in same window.

enter image description here

3
  • share the button script here
    – apKash
    Commented Mar 2, 2016 at 10:51
  • I am assinging VF page for the button. If i change behavior "Display in existing window" standard view page redirecting to VF word document page and document downloaded. But i want stay standard page only. Commented Mar 2, 2016 at 11:17
  • @Ratan, some what it's working. onclick will not opening new window but it's opening new tab. Commented Mar 2, 2016 at 11:32

1 Answer 1

0

Given an Extension to your Visual force page with the below code:

contentType="application/msWord#yourFile.doc"

So, your word will be downloaded without displaying a new window.

Hope it helps you.

6
  • i am using that one. but not getting. Commented Mar 2, 2016 at 11:34
  • Strange. Any errors? Have you checked any wrong typos in contentType?
    – Rv1
    Commented Mar 2, 2016 at 11:43
  • No errors, it's redirecting standard page to vf page in same tab. but i want to stay in standard view page. My tag is like contentType="application/msWord#HR_WordDocument.doc" Commented Mar 2, 2016 at 11:54
  • I hope you're developing the VF page in respective instance only. In that case, it will redirected and remain in same VF page. Please disable the Development Mode and test the button. You will get your expected behavior.
    – Rv1
    Commented Mar 2, 2016 at 11:59
  • Yes, now i got. Disabled the development mode. Thanks. Commented Mar 2, 2016 at 12:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .