共用方式為


XpsDocument 建構函式

定義

初始化 XpsDocument 類別的新執行個體。

多載

XpsDocument(Package)

以存取指定的 XML 文件規格 (XPS) Package 和預設的交錯、資源和壓縮選項,將 XpsDocument 類別的新執行個體初始化。

XpsDocument(Package, CompressionOption)

使用指定的預設交錯、資源和壓縮選項,初始化 XpsDocument 類別的新執行個體,此類別包含於指定的 Package

XpsDocument(String, FileAccess)

使用預設交錯、資源和壓縮選項,初始化 XpsDocument 類別的新執行個體,此類別包含於指定的 Package 檔案。

XpsDocument(Package, CompressionOption, String)

使用指定的預設交錯、資源和壓縮選項,初始化 XpsDocument 類別的新執行個體,此類別包含於指定的 Package

XpsDocument(String, FileAccess, CompressionOption)

使用預設交錯、資源和壓縮選項,初始化 XpsDocument 類別的新執行個體,此類別包含於指定的 Package 檔案。

範例

下列範例示範如何建立和關閉 XpsDocument

// Create an XpsDocument package (without PrintTicket).
{
   Package^ package = Package::Open(packageName);
   try
   {
      XpsDocument^ xpsDocument = gcnew XpsDocument(package);

      // Add the package content (false=without PrintTicket).
      AddPackageContent(xpsDocument, false);

      // Close the package.
      xpsDocument->Close();
   } finally
   {
      delete package;
   }
// Create an XpsDocument package (without PrintTicket).
using (Package package = Package.Open(packageName))
{
    XpsDocument xpsDocument = new XpsDocument(package);

    // Add the package content (false=without PrintTicket).
    AddPackageContent(xpsDocument, false);

    // Close the package.
    xpsDocument.Close();
}
' Create an XpsDocument package (without PrintTicket).
Using package1 As Package = Package.Open(packageName)
    Dim xpsDocument As New XpsDocument(package1)

    ' Add the package content (false=without PrintTicket).
    AddPackageContent(xpsDocument, False)

    ' Close the package.
    xpsDocument.Close()
End Using

下列範例也會示範如何建立和關閉 XpsDocument

// Save as a WordXML document.
WordXmlSerializer.SaveToFile(fileName, flowDocument.ContentStart, flowDocument.ContentEnd);
return true;

XpsDocument(Package)

以存取指定的 XML 文件規格 (XPS) Package 和預設的交錯、資源和壓縮選項,將 XpsDocument 類別的新執行個體初始化。

public:
 XpsDocument(System::IO::Packaging::Package ^ package);
public XpsDocument (System.IO.Packaging.Package package);
new System.Windows.Xps.Packaging.XpsDocument : System.IO.Packaging.Package -> System.Windows.Xps.Packaging.XpsDocument
Public Sub New (package As Package)

參數

package
Package

XpsDocument 的目標 XPS 套件。

範例

下列範例示範如何建立和關閉 XpsDocument

// Create an XpsDocument package (without PrintTicket).
{
   Package^ package = Package::Open(packageName);
   try
   {
      XpsDocument^ xpsDocument = gcnew XpsDocument(package);

      // Add the package content (false=without PrintTicket).
      AddPackageContent(xpsDocument, false);

      // Close the package.
      xpsDocument->Close();
   } finally
   {
      delete package;
   }
// Create an XpsDocument package (without PrintTicket).
using (Package package = Package.Open(packageName))
{
    XpsDocument xpsDocument = new XpsDocument(package);

    // Add the package content (false=without PrintTicket).
    AddPackageContent(xpsDocument, false);

    // Close the package.
    xpsDocument.Close();
}
' Create an XpsDocument package (without PrintTicket).
Using package1 As Package = Package.Open(packageName)
    Dim xpsDocument As New XpsDocument(package1)

    ' Add the package content (false=without PrintTicket).
    AddPackageContent(xpsDocument, False)

    ' Close the package.
    xpsDocument.Close()
End Using

下列範例也會示範如何建立和關閉 XpsDocument

// Save as a WordXML document.
WordXmlSerializer.SaveToFile(fileName, flowDocument.ContentStart, flowDocument.ContentEnd);
return true;

適用於

XpsDocument(Package, CompressionOption)

使用指定的預設交錯、資源和壓縮選項,初始化 XpsDocument 類別的新執行個體,此類別包含於指定的 Package

public:
 XpsDocument(System::IO::Packaging::Package ^ package, System::IO::Packaging::CompressionOption compressionOption);
public XpsDocument (System.IO.Packaging.Package package, System.IO.Packaging.CompressionOption compressionOption);
new System.Windows.Xps.Packaging.XpsDocument : System.IO.Packaging.Package * System.IO.Packaging.CompressionOption -> System.Windows.Xps.Packaging.XpsDocument
Public Sub New (package As Package, compressionOption As CompressionOption)

參數

package
Package

XpsDocument 的目標封裝。

compressionOption
CompressionOption

封裝壓縮選項。

範例

下列範例示範如何建立和關閉 XpsDocument

// Create an XpsDocument package (without PrintTicket).
{
   Package^ package = Package::Open(packageName);
   try
   {
      XpsDocument^ xpsDocument = gcnew XpsDocument(package);

      // Add the package content (false=without PrintTicket).
      AddPackageContent(xpsDocument, false);

      // Close the package.
      xpsDocument->Close();
   } finally
   {
      delete package;
   }
// Create an XpsDocument package (without PrintTicket).
using (Package package = Package.Open(packageName))
{
    XpsDocument xpsDocument = new XpsDocument(package);

    // Add the package content (false=without PrintTicket).
    AddPackageContent(xpsDocument, false);

    // Close the package.
    xpsDocument.Close();
}
' Create an XpsDocument package (without PrintTicket).
Using package1 As Package = Package.Open(packageName)
    Dim xpsDocument As New XpsDocument(package1)

    ' Add the package content (false=without PrintTicket).
    AddPackageContent(xpsDocument, False)

    ' Close the package.
    xpsDocument.Close()
End Using

下列範例也會示範如何建立和關閉 XpsDocument

// Save as a WordXML document.
WordXmlSerializer.SaveToFile(fileName, flowDocument.ContentStart, flowDocument.ContentEnd);
return true;

適用於

XpsDocument(String, FileAccess)

使用預設交錯、資源和壓縮選項,初始化 XpsDocument 類別的新執行個體,此類別包含於指定的 Package 檔案。

public:
 XpsDocument(System::String ^ path, System::IO::FileAccess packageAccess);
public XpsDocument (string path, System.IO.FileAccess packageAccess);
new System.Windows.Xps.Packaging.XpsDocument : string * System.IO.FileAccess -> System.Windows.Xps.Packaging.XpsDocument
Public Sub New (path As String, packageAccess As FileAccess)

參數

path
String

Package 之目標 XpsDocument 的路徑和檔案名稱。

packageAccess
FileAccess

開啟 XpsDocument 的檔案 I/O 模式。

範例

下列範例示範如何建立和關閉 XpsDocument

// Create an XpsDocument package (without PrintTicket).
{
   Package^ package = Package::Open(packageName);
   try
   {
      XpsDocument^ xpsDocument = gcnew XpsDocument(package);

      // Add the package content (false=without PrintTicket).
      AddPackageContent(xpsDocument, false);

      // Close the package.
      xpsDocument->Close();
   } finally
   {
      delete package;
   }
// Create an XpsDocument package (without PrintTicket).
using (Package package = Package.Open(packageName))
{
    XpsDocument xpsDocument = new XpsDocument(package);

    // Add the package content (false=without PrintTicket).
    AddPackageContent(xpsDocument, false);

    // Close the package.
    xpsDocument.Close();
}
' Create an XpsDocument package (without PrintTicket).
Using package1 As Package = Package.Open(packageName)
    Dim xpsDocument As New XpsDocument(package1)

    ' Add the package content (false=without PrintTicket).
    AddPackageContent(xpsDocument, False)

    ' Close the package.
    xpsDocument.Close()
End Using

下列範例也會示範如何建立和關閉 XpsDocument

// Save as a WordXML document.
WordXmlSerializer.SaveToFile(fileName, flowDocument.ContentStart, flowDocument.ContentEnd);
return true;

適用於

XpsDocument(Package, CompressionOption, String)

使用指定的預設交錯、資源和壓縮選項,初始化 XpsDocument 類別的新執行個體,此類別包含於指定的 Package

public:
 XpsDocument(System::IO::Packaging::Package ^ package, System::IO::Packaging::CompressionOption compressionOption, System::String ^ path);
public XpsDocument (System.IO.Packaging.Package package, System.IO.Packaging.CompressionOption compressionOption, string path);
new System.Windows.Xps.Packaging.XpsDocument : System.IO.Packaging.Package * System.IO.Packaging.CompressionOption * string -> System.Windows.Xps.Packaging.XpsDocument
Public Sub New (package As Package, compressionOption As CompressionOption, path As String)

參數

package
Package

XpsDocument 的目標封裝。

compressionOption
CompressionOption

封裝壓縮選項。

path
String

文件的統一資源識別項 (URI),以字串形式表示。

範例

下列範例示範如何建立和關閉 XpsDocument

// Create an XpsDocument package (without PrintTicket).
{
   Package^ package = Package::Open(packageName);
   try
   {
      XpsDocument^ xpsDocument = gcnew XpsDocument(package);

      // Add the package content (false=without PrintTicket).
      AddPackageContent(xpsDocument, false);

      // Close the package.
      xpsDocument->Close();
   } finally
   {
      delete package;
   }
// Create an XpsDocument package (without PrintTicket).
using (Package package = Package.Open(packageName))
{
    XpsDocument xpsDocument = new XpsDocument(package);

    // Add the package content (false=without PrintTicket).
    AddPackageContent(xpsDocument, false);

    // Close the package.
    xpsDocument.Close();
}
' Create an XpsDocument package (without PrintTicket).
Using package1 As Package = Package.Open(packageName)
    Dim xpsDocument As New XpsDocument(package1)

    ' Add the package content (false=without PrintTicket).
    AddPackageContent(xpsDocument, False)

    ' Close the package.
    xpsDocument.Close()
End Using

下列範例也會示範如何建立和關閉 XpsDocument

// Save as a WordXML document.
WordXmlSerializer.SaveToFile(fileName, flowDocument.ContentStart, flowDocument.ContentEnd);
return true;

適用於

XpsDocument(String, FileAccess, CompressionOption)

使用預設交錯、資源和壓縮選項,初始化 XpsDocument 類別的新執行個體,此類別包含於指定的 Package 檔案。

public:
 XpsDocument(System::String ^ path, System::IO::FileAccess packageAccess, System::IO::Packaging::CompressionOption compressionOption);
public XpsDocument (string path, System.IO.FileAccess packageAccess, System.IO.Packaging.CompressionOption compressionOption);
new System.Windows.Xps.Packaging.XpsDocument : string * System.IO.FileAccess * System.IO.Packaging.CompressionOption -> System.Windows.Xps.Packaging.XpsDocument
Public Sub New (path As String, packageAccess As FileAccess, compressionOption As CompressionOption)

參數

path
String

Package 之目標 XpsDocument 的路徑和檔案名稱。

packageAccess
FileAccess

開啟 XpsDocument 的檔案 I/O 模式。

compressionOption
CompressionOption

封裝壓縮選項。

範例

下列範例示範如何建立和關閉 XpsDocument

// Create an XpsDocument package (without PrintTicket).
{
   Package^ package = Package::Open(packageName);
   try
   {
      XpsDocument^ xpsDocument = gcnew XpsDocument(package);

      // Add the package content (false=without PrintTicket).
      AddPackageContent(xpsDocument, false);

      // Close the package.
      xpsDocument->Close();
   } finally
   {
      delete package;
   }
// Create an XpsDocument package (without PrintTicket).
using (Package package = Package.Open(packageName))
{
    XpsDocument xpsDocument = new XpsDocument(package);

    // Add the package content (false=without PrintTicket).
    AddPackageContent(xpsDocument, false);

    // Close the package.
    xpsDocument.Close();
}
' Create an XpsDocument package (without PrintTicket).
Using package1 As Package = Package.Open(packageName)
    Dim xpsDocument As New XpsDocument(package1)

    ' Add the package content (false=without PrintTicket).
    AddPackageContent(xpsDocument, False)

    ' Close the package.
    xpsDocument.Close()
End Using

下列範例也會示範如何建立和關閉 XpsDocument

// Save as a WordXML document.
WordXmlSerializer.SaveToFile(fileName, flowDocument.ContentStart, flowDocument.ContentEnd);
return true;

適用於