_Workbook.ExportAsFixedFormat Method
The ExportAsFixedFormat(XlFixedFormatType, Object, Object, Object, Object, Object, Object, Object, Object) method is used to publish a workbook to either the PDF or XPS format.
Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)
Syntax
'Declaration
Sub ExportAsFixedFormat ( _
Type As XlFixedFormatType, _
Filename As Object, _
Quality As Object, _
IncludeDocProperties As Object, _
IgnorePrintAreas As Object, _
From As Object, _
To As Object, _
OpenAfterPublish As Object, _
FixedFormatExtClassPtr As Object _
)
'Usage
Dim instance As _Workbook
Dim Type As XlFixedFormatType
Dim Filename As Object
Dim Quality As Object
Dim IncludeDocProperties As Object
Dim IgnorePrintAreas As Object
Dim From As Object
Dim To As Object
Dim OpenAfterPublish As Object
Dim FixedFormatExtClassPtr As Object
instance.ExportAsFixedFormat(Type, Filename, _
Quality, IncludeDocProperties, IgnorePrintAreas, _
From, To, OpenAfterPublish, FixedFormatExtClassPtr)
void ExportAsFixedFormat(
XlFixedFormatType Type,
Object Filename,
Object Quality,
Object IncludeDocProperties,
Object IgnorePrintAreas,
Object From,
Object To,
Object OpenAfterPublish,
Object FixedFormatExtClassPtr
)
Parameters
Filename
Type: System.ObjectA String that indicates the name of the file to be saved. You can include a full path or short. Excel2007 saves the file in the current folder.
Quality
Type: System.ObjectCan be set to either xlQualityStandard or xlQualityMinimum.
IncludeDocProperties
Type: System.ObjectSet to True to indicate that document properties should be included or set to False to indicate that they are omitted.
IgnorePrintAreas
Type: System.ObjectIf set to True, ignores any print areas set when publishing. If set to False, will use the print areas set when publishing.
From
Type: System.ObjectThe number of the page at which to start publishing. If this argument is omitted, publishing starts at the beginning.
To
Type: System.ObjectThe number of the last page to publish. If this argument is omitted, publishing ends with the last page
OpenAfterPublish
Type: System.ObjectIf set to True displays file in viewer after it is published. If set to False the file is published but not displayed.
FixedFormatExtClassPtr
Type: System.ObjectPointer to the FixedFormatExt class.
Examples
The following example creates the PDF at standard quality in the current file’s directory and displays file in viewer after it is published.
Note
An error will occur if the PDF add-in is not currently installed.