Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WorksheetBase.ExportAsFixedFormat Method

Exports to a file of the specified format.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

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 argument is omitted, exporting starts at the first page.

to
Type: System.Object

The number of the last page to export. If this argument is omitted, exporting ends with the last page.

openAfterPublish
Type: System.Object

true to display the file in the viewer immediately; 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.

This method also supports initializing an add-in to export a file to a fixed-format file. For example, Excel will perform file format conversion if the converters are present. The conversion is usually initiated by the user.

The following code example saves the content of the worksheet Sheet1 in PDF format, up to the first four pages (ignoring print areas). The PDF file is saved to the specified file path and file name using the standard quality resolution. The file includes the workbook properties. To run this code example, your workbook must include a sheet named Sheet1 with some data.

This example is for a document-level customization.

private void SaveWorksheetAsPDF()        
{            
    Microsoft.Office.Tools.Excel.Worksheet mySheet =
        Globals.Sheet1.Base;

    mySheet.ExportAsFixedFormat( 
        Excel.XlFixedFormatType.xlTypePDF, 
        @"c:\myWorksheet", 
        Excel.XlFixedFormatQuality.xlQualityStandard, 
        true, 
        true, 
        1, 
        10, 
        false);
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft