XmlMappedRange.ExportAsFixedFormat 方法

匯出成指定格式的檔案。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel (在 Microsoft.Office.Tools.Excel.dll 中)

語法

'宣告
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
)

參數

  • Filename
    型別:System.Object
    字串,包含要儲存之檔案的名稱。您可以加入完整路徑,否則 Excel 會將檔案儲存在目前的資料夾中。
  • Quality
    型別:System.Object
    其中一個 Microsoft.Office.Interop.Excel.XlFixedFormatQuality 值,指定匯出檔案的品質。
  • IncludeDocProperties
    型別:System.Object
    true 表示要包含文件摘要資訊,否則為 false。
  • IgnorePrintAreas
    型別:System.Object
    若要在匯出時忽略任何列印範圍設定則為 true,否則為 false。
  • From
    型別:System.Object
    要開始匯出的頁碼。如果省略這個引數,會從第一頁開始匯出。
  • To
    型別:System.Object
    要匯出之最後一頁的頁碼。如果省略這個引數,會匯出直到最後一頁。
  • OpenAfterPublish
    型別:System.Object
    true 表示要在發行檔案後在檢視器中加以顯示,否則為 false。
  • FixedFormatExtClassPtr
    型別:System.Object
    IMsoDocExporter 介面的實作之指標,能夠以不同的固定格式儲存活頁簿。如需詳細資訊,請參閱<擴充 Office (2007) 固定格式匯出功能>。

備註

這個方法也支援初始化增益集,以便將檔案匯出成固定格式的檔案。 例如,如果有轉換子,Excel 就會執行檔案格式轉換。 轉換通常是由使用者啟始。

範例

下列範例程式碼會設定 EmployeeNameCell 的值。 Sheet1 上的 XmlMappedRange 控制項。 接下來,這個範例會依據指定的資料夾和檔案名稱,將 EmployeeSeniorityCell 的內容匯出為 PDF 文件。

注意事項注意事項

一般而言,您會從 XML 檔案填入 XmlMappedRange 控制項。為了簡單起見,這個範例會硬式編碼此控制項的值。

Private Sub SaveXMLMappedRangeAsPDF()
    Globals.Sheet1.EmployeeNameCell.Value2 = "Karina Leal"

    Globals.Sheet1.EmployeeNameCell.ExportAsFixedFormat( _
        Excel.XlFixedFormatType.xlTypePDF, _
        "c:\EmployeeInfo", _
        Excel.XlFixedFormatQuality.xlQualityStandard, _
        True, _
        True, _
        1, _
        1, _
        False)
End Sub
private void SaveXMLMappedRangeAsPDF()
{
    Globals.Sheet1.EmployeeNameCell.Value2 = "Karina Leal";

    Globals.Sheet1.EmployeeNameCell.ExportAsFixedFormat(
        Excel.XlFixedFormatType.xlTypePDF,
        @"c:\EmployeeInfo",
        Excel.XlFixedFormatQuality.xlQualityStandard,
        true,
        true,
        1,
        1,
        false);
}

.NET Framework 安全性

請參閱

參考

XmlMappedRange 介面

Microsoft.Office.Tools.Excel 命名空間