Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a small problem that I need to open word documents from button click event from SharePoint document library. Can anyone help me on this?

New Word Document opened:

a) A new word document opened from clicking the create button from the main application insert data and will get saved in the document library directly.

b) Allows user to write data and will get saved by saving the document.

share|improve this question
add comment

2 Answers

New Document, create a link like this:

<a href="/ServerRelativePath/_layouts/FormServer.aspx?XsnLocation=/ServerRelativePath/List%20name/Forms/template.xsn&SaveLocation=%2F/ServerRelativePath%2FList%20Name&Source=%2F/ServerRelativePath%2FList%2520Name%2FForms%2FCV%2520AllItems%2Easpx&DefaultItemOpen=1">Create new document</a>

To open a special document, create a link like this (providing you have the SPFile object):

"http://path/_layouts/FormServer.aspx?XmlLocation=http://path/" +       item.File.Url.Replace(" ", "%20") + "&OpenIn=Browser";
share|improve this answer
add comment

Refer this post to open a word document on click:

Open word document from codebehind - e.g Response.Write with some javascript

You can further decide to spit/call this function on client click of any button.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.