Message-ID: <884780940.9509.1711692565033.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_9508_1227058383.1711692565033" ------=_Part_9508_1227058383.1711692565033 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Writes a Document to a file and sa= ves it to a SharePoint List Item.
=20public static void Save(this WordApplication wordApplication, Document docu= ment, Microsoft.SharePoint.SPListItem listItem, string fileName)=20
Public Shared Sub Save(ByVal wordApplication As WordApplication, ByVal docu= ment As Document, ByVal docLib As Microsoft.SharePoint.SPListItem, ByVal fi= leName As String)=20
Document
to save.=20
Document
=20
The W=
ordApplication.Preserve property is used to specify the way WordWriter =
will save the document. When the preserve
property is set to t=
rue, WordWriter attempts to preserve all formatting and features that it do=
esn't directly support. This includes Fields, Footnotes, Hyperlinks, Commen=
ts, and Anchored Images. When the preserve
property is false, =
only those features directly supported by WordWriter will be preserved. Thi=
s includes all Tables, Lists, Headers and Footers.
//--- Retrieve current AllowUnsafeUpdates value bool currentAllowUnsafeUpdates =3D list.ParentWeb.AllowUnsafeUpdates; //--- You must allow unsafe updates in order for the file to be saved in th= e //--- List from a web application list.ParentWeb.AllowUnsafeUpdates =3D true; wa.Save(doc, listItem, "populated.doc"); //--- Update the list listItem.Update(); //--- Return the AllowUnsafeUpdates value to its original state list.ParentWeb.AllowUnsafeUpdates =3D currentAllowUnsafeUpdates;=20
'--- Retrieve current AllowUnsafeUpdates value Dim currentAllowUnsafeUpdates As Boolean =3D list.ParentWeb.AllowUnsafeUpda= tes '--- You must allow unsafe updates in order for the file to be saved in the '--- List from a web application list.ParentWeb.AllowUnsafeUpdates =3D True wa.Save(doc, listItem, "populated.doc") '--- Update the list listItem.Update() '--- Return the AllowUnsafeUpdates value to its original state list.ParentWeb.AllowUnsafeUpdates =3D currentAllowUnsafeUpdates=20