Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Reference
 ExportAsFixedFormat Method (2007 S...
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Studio Tools for Office API Reference
Workbook..::.ExportAsFixedFormat Method (2007 System)

Saves a workbook in PDF or XPS format.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Visual Basic (Declaration)
Public 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 _
)
Visual Basic (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)
C#
public void ExportAsFixedFormat(
    XlFixedFormatType Type,
    Object Filename,
    Object Quality,
    Object IncludeDocProperties,
    Object IgnorePrintAreas,
    Object From,
    Object To,
    Object OpenAfterPublish,
    Object FixedFormatExtClassPtr
)

Parameters

Type
Type: Microsoft.Office.Interop.Excel..::.XlFixedFormatType
One of the Microsoft.Office.Interop.Excel.XlFixedFormatType values that specifies whether to save the workbook in PDF or XPS format.
Filename
Type: System..::.Object
The full path of the new PDF or XPS file. If you omit this parameter, Excel saves the file in the current folder.
Quality
Type: System..::.Object
One of the Microsoft.Office.Interop.Excel.XlFixedFormatQuality values that specifies the quality of the exported file.
IncludeDocProperties
Type: System..::.Object
true to include document properties in the exported file; otherwise, false.
IgnorePrintAreas
Type: System..::.Object
true to ignore any print areas set when exporting; otherwise, false.
From
Type: System..::.Object
The number of the page at which to start exporting. If this parameter is omitted, exporting starts at the beginning.
To
Type: System..::.Object
The number of the last page to export. If this parameter is omitted, exporting ends with the last page.
OpenAfterPublish
Type: System..::.Object
true to open the new file after exporting the workbook; otherwise, false.
FixedFormatExtClassPtr
Type: System..::.Object
A pointer to an implementation of the IMsoDocExporter interface that enables the workbook to be saved in a different fixed format. For more information, see Extending the Office (2007) Fixed-Format Export Feature.

You can save as a PDF or XPS file from Microsoft Office Excel only after you install an add-in that provides this feature. For more information, search for "Enable support for other file formats, such as PDF and XPS" on Office Online.

Optional Parameters

For information on optional parameters, see The Variable missing and Optional Parameters in Office Solutions.

The following code example saves the first page of the workbook in PDF format to the specified file path using high-quality resolution.

This example is for a document-level customization.

Visual Basic
Private Sub SaveAsPDF()
    Me.ExportAsFixedFormat( _
        Excel.XlFixedFormatType.xlTypePDF, _
        "c:\myWorkbook", _
        Excel.XlFixedFormatQuality.xlQualityStandard, _
        True, _
        True, _
        1, _
        1, _
        False)
End Sub
C#
private void SaveAsPDF()
{                        
    this.ExportAsFixedFormat(
        Excel.XlFixedFormatType.xlTypePDF,
        @"c:\myWorkbook",
        Excel.XlFixedFormatQuality.xlQualityStandard,
        true,
        true,
        1,
        1,
        false,
        missing);
}
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker