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.

2 Answers 2


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";

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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