Expand Minimize

NamedRange.ExportAsFixedFormat Method

Exports to a file of the specified format.

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

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
The type of file format to export to.
Filename
Type: System.Object
The file name of the file to be saved. You can include a full path, or Excel saves the file in the current folder.
Quality
Type: System.Object
Optional XlFixedFormatQuality. Specifies the quality of the published file.
IncludeDocProperties
Type: System.Object
true to include the document properties; 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 first page to start exporting. By default, exporting starts at the beginning.
To
Type: System.Object
The number of the last page to export. By default, exporting ends at 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 one page that contains the named range NamedRange1 in PDF format to the specified file path and file name using the standard quality resolution. The generated PDF file includes the workbook properties. To run this code example, your workbook must include a sheet named Sheet1 with a named range named NamedRange1 that contains some data.

This example is for a document-level customization.


private void SaveNamedRangeAsPDF()
{
    Microsoft.Office.Tools.Excel.NamedRange myNamedRange = 
        Globals.Sheet1.namedRange1;

    myNamedRange.ExportAsFixedFormat( 
        Excel.XlFixedFormatType.xlTypePDF, 
        @"c:\SalesData", 
        Excel.XlFixedFormatQuality.xlQualityStandard, 
        true, 
        true, 
        1, 
        1,
        false,
        missing);
}


Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft