Message-ID: <930346514.8119.1711632768259.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8118_1086893928.1711632768259" ------=_Part_8118_1086893928.1711632768259 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html SharePointIntegration.Save(ExcelApplication, Workbook, Microsoft= .SharePoint.SPDocumentLibrary, String, Boolean)

SharePointIntegration.Save(ExcelApplication, Workbook, Microsoft.Sh= arePoint.SPDocumentLibrary, String, Boolean)

Introduced in build 7.1.0.1855

= =20

Description

=20

Saves a specified Workbook as a BI= FF8 format (Excel 97 or later) .xls file.

=20
C#
=20
public static void Save(this ExcelApplication excelApplication, Workbook wo=
rkbook, Microsoft.SharePoint.SPDocumentLibrary docLib, String fileName, boo=
l overwrite)
=20
=20
vb.net
=20
Public Overridable Sub Save(ByVal excelApplication As ExcelApplication, ByV=
al workbook As Workbook, ByVal docLib As Microsoft.SharePoint.SPDocumentLib=
rary, ByVal fileName As String, ByVal overwrite As Boolean)
=20
=20

Parameters

=20
excelApplicati= on
The current ExcelApplication object which is saving the workbook to= file=20
workbook
A=20 Workbook object representing the workbook to save.=20
docLib
SharePoint D= ocument Library that contains the Excel spreadsheet being opened=20
fileName
Specifie= s a file name for the Workbook. ExcelWriter will save the file to the docum= ent library using this name. If a file with the same name exists, it will b= e overwritten by the new Excel file if the overwrite parameter is set to Tr= ue.=20
overwrite
Set to= True to overwrite an Excel file if one already exists by that name in the = Document Library=20

Exceptions

=20
System.Excepti= on
If there is a problem creating, opening, or writing to the file spe= cified, or reading from the workbook object.=20

Remarks

=20
=20 Icon=20
=20

This is an extension method for the ExcelApplication object to be used f= or saving spreadsheets to SharePoint Document Libraries. To use this method= , you must add a reference to SoftArtisans.OfficeWriter.ExcelWriter.SharePo= intIntegration.dll

=20
=20
=20

Examples

=20
C#
=20
//--- Retrieve current AllowUnsafeUpdates value
bool currentAllowUnsafeUpdates =3D documentLibrary.ParentWeb.AllowUnsafeUpd=
ates;

//--- You must allow unsafe updates in order for the file to be saved in th=
e
//--- Document Library from a web application
documentLibrary.ParentWeb.AllowUnsafeUpdates =3D true;
xla.Save(wb, documentLibrary, "populated.xls", true);

//--- Update the document library
documentLibrary.Update();

//--- Return the AllowUnsafeUpdates value to its original state
documentLibrary.ParentWeb.AllowUnsafeUpdates =3D currentAllowUnsafeUpdates;
=20
=20
vb.net
=20
'--- Retrieve current AllowUnsafeUpdates value
Dim currentAllowUnsafeUpdates As Boolean =3D documentLibrary.ParentWeb.Allo=
wUnsafeUpdates

'--- You must allow unsafe updates in order for the file to be saved in the
'--- Document Library from a web application
documentLibrary.ParentWeb.AllowUnsafeUpdates =3D True
xla.Save(wb, documentLibrary, "populated.xls", True)

'--- Update the document library
documentLibrary.Update()

'--- Return the AllowUnsafeUpdates value to its original state
documentLibrary.ParentWeb.AllowUnsafeUpdates =3D currentAllowUnsafeUpdates
=20
------=_Part_8118_1086893928.1711632768259--