Chart.ExportAsFixedFormat Method
Saves the chart in either PDF or XPS format.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.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 _
)
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.XlFixedFormatTypeOne of the T:Microsoft.Office.Interop.Excel.XlFixedFormatType values that specifies whether to save the chart in PDF or XPS format.
Filename
Type: System.ObjectThe 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.ObjectOne of the T:Microsoft.Office.Interop.Excel.XlFixedFormatQuality values that specifies the quality of the exported file.
IncludeDocProperties
Type: System.Objecttrue to include document properties in the exported file; otherwise, false.
IgnorePrintAreas
Type: System.Objecttrue to ignore any print areas set when exporting; otherwise, false.
From
Type: System.ObjectThe number of the page at which to start exporting. If this parameter is omitted, exporting starts at the beginning.
To
Type: System.ObjectThe number of the last page to export. If this parameter is omitted, exporting ends with the last page.
OpenAfterPublish
Type: System.Objecttrue to open the new file after exporting the chart; otherwise, false.
FixedFormatExtClassPtr
Type: System.ObjectA pointer to an implementation of the IMsoDocExporter interface that enables the chart to be saved in a different fixed format. For more information, see Extending the Office (2007) Fixed-Format Export Feature.
Remarks
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 about optional parameters, see Optional Parameters in Office Solutions.
Examples
The following code example saves one page of the chart Chart_1 of worksheet Sheet1 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 chart named Chart_1.
Private Sub SaveChartAsPDF()
Dim myChart As Microsoft.Office.Tools.Excel.Chart = _
Globals.Sheet1.Chart_1
myChart.ExportAsFixedFormat( _
Excel.XlFixedFormatType.xlTypePDF, _
"c:\SalesChart", _
Excel.XlFixedFormatQuality.xlQualityStandard, _
True, _
True, _
1, _
1, _
False)
End Sub
private void SaveChartAsPDF()
{
Microsoft.Office.Tools.Excel.Chart myChart =
Globals.Sheet1.Chart_1;
myChart.ExportAsFixedFormat(
Excel.XlFixedFormatType.xlTypePDF,
@"c:\SalesChart",
Excel.XlFixedFormatQuality.xlQualityStandard,
true,
true,
1,
1,
false);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.