Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

Wiki Markup
{introducedin:4.1.0.1379

...

Description

Excerpt

Opens and returns an existing Document from a SharePoint List Item.

Signature
C#C#
}
{description}
{excerpt}Opens and returns an existing [Document|Document] from a SharePoint List Item.{excerpt}
{signature:C#}
public Document Open(this WordApplication wordApplication, Microsoft.SharePoint.SPListItem listItem, String fileName)
Signature
{signature}{signature:vb.net
vb.net
}
Public Function Open(ByVal wordApplication As WordApplication, ByVal listItem As Microsoft.SharePoint.SPListItem, ByVal fileName As String) As Document
Parameters

...

The current WordApplication object which is calling Open

...

SharePoint List Item from which the file is being opened

...

Filename of the document to open from the List Item

Returns

The document that is opened from the List Item.

Exceptions
This is an extension method for the WordApplication object to be used for opening documents from a SharePoint List Item from within SharePoint. To use this method, you must add a reference to
{signature}
{parameters}
{param:wordApplication}The current WordApplication object which is calling Open{param}
{param:listItem}SharePoint List Item from which the file is being opened{param}
{param:fileName}Filename of the document to open from the List Item{param}
{returns}The document that is opened from the List Item.{returns}
{exceptions}
{exception:System.Exception}Thrown if an error occurs while opening the document.{exception}
{remarks}Though the [WordTemplate|WordTemplate] object currently supports Office Open XML \(Word 2007\) format files, [WordApplication.Open()|WordApplication.Open] does not yet support them.
{note}This is an extension method for the WordApplication object to be used for opening documents from a SharePoint List Item from within SharePoint.  To use this method, you must add a reference to SoftArtisans.OfficeWriter.WordWriter.SharePointIntegration.dll
{note}
{remarks}
{example}{code:csharp|title=C#}
Document doc = app.Open(myListItem, "sample.doc");
{code}
{code:vb.net
|title=vb.net
}
Dim doc As Document = app.Open(myListItem, "sample.doc"){code}

{example}
Exception
System.ExceptionSystem.Exception

Thrown if an error occurs while opening the document.

Remarks

Though the WordTemplate object currently supports Office Open XML (Word 2007) format files, WordApplication.Open() does not yet support them.

Note
Example
Code Block
csharpcsharp
titleC#
Code Block
vb.nettitle