共用方式為


SerializerWriter.Write 方法

定義

在衍生類別中覆寫時,以同步方式將內容寫入至序列化 Stream

多載

Write(Visual, PrintTicket)

在衍生類別中覆寫時,以同步方式將指定的 Visual 元素連同相關聯的 PrintTicket 一起寫入至序列化 Stream

Write(FixedPage, PrintTicket)

在衍生類別中覆寫時,以同步方式將指定的 FixedPage 連同相關聯的 PrintTicket 一起寫入至序列化 Stream

Write(FixedDocument, PrintTicket)

在衍生類別中覆寫時,以同步方式將指定的 FixedDocument 連同相關聯的 PrintTicket 一起寫入至序列化 Stream

Write(DocumentPaginator, PrintTicket)

在衍生類別中覆寫時,以同步方式將分頁內容連同相關聯的 PrintTicket 一起寫入至序列化 Stream

Write(FixedDocumentSequence, PrintTicket)

在衍生類別中覆寫時,以同步方式將指定的 FixedDocumentSequence 連同相關聯的 PrintTicket 一起寫入至序列化 Stream

Write(FixedPage)

在衍生類別中覆寫時,以同步方式將指定的 FixedPage 寫入至序列化 Stream

Write(FixedDocumentSequence)

在衍生類別中覆寫時,以同步方式將指定的 FixedDocumentSequence 寫入至序列化 Stream

Write(FixedDocument)

在衍生類別中覆寫時,以同步方式將指定的 FixedDocument 寫入至序列化 Stream

Write(DocumentPaginator)

在衍生類別中覆寫時,以同步方式將指定 DocumentPaginator 的內容寫入至序列化 Stream

Write(Visual)

在衍生類別中覆寫時,以同步方式將指定的 Visual 元素寫入至序列化 Stream

範例

下列範例示範如何使用 Write 方法將流程檔序列化至輸出檔案。

// Create a SerializerProvider for accessing plug-in serializers.
SerializerProvider serializerProvider = new SerializerProvider();

// Locate the serializer that matches the fileName extension.
SerializerDescriptor selectedPlugIn = null;
foreach ( SerializerDescriptor serializerDescriptor in
                serializerProvider.InstalledSerializers )
{
    if ( serializerDescriptor.IsLoadable &&
         fileName.EndsWith(serializerDescriptor.DefaultFileExtension) )
    {   // The plug-in serializer and fileName extensions match.
        selectedPlugIn = serializerDescriptor;
        break; // foreach
    }
}

// If a match for a plug-in serializer was found,
// use it to output and store the document.
if (selectedPlugIn != null)
{
    Stream package = File.Create(fileName);
    SerializerWriter serializerWriter =
        serializerProvider.CreateSerializerWriter(selectedPlugIn,
                                                  package);
    IDocumentPaginatorSource idoc =
        flowDocument as IDocumentPaginatorSource;
    serializerWriter.Write(idoc.DocumentPaginator, null);
    package.Close();
    return true;
}

備註

寫入作業的輸出 Stream 通常會指定為實作 之衍生類別 SerializerWriter 之建構函式的參數。

Write(Visual, PrintTicket)

在衍生類別中覆寫時,以同步方式將指定的 Visual 元素連同相關聯的 PrintTicket 一起寫入至序列化 Stream

public:
 abstract void Write(System::Windows::Media::Visual ^ visual, System::Printing::PrintTicket ^ printTicket);
public abstract void Write (System.Windows.Media.Visual visual, System.Printing.PrintTicket printTicket);
abstract member Write : System.Windows.Media.Visual * System.Printing.PrintTicket -> unit
Public MustOverride Sub Write (visual As Visual, printTicket As PrintTicket)

參數

visual
Visual

要寫入序列化 StreamVisual 項目。

printTicket
PrintTicket

visual 項目的預設列印喜好設定。

範例

下列範例示範如何使用 Write(DocumentPaginator, PrintTicket) 方法將流程檔序列化至輸出檔案。

// Create a SerializerProvider for accessing plug-in serializers.
SerializerProvider serializerProvider = new SerializerProvider();

// Locate the serializer that matches the fileName extension.
SerializerDescriptor selectedPlugIn = null;
foreach ( SerializerDescriptor serializerDescriptor in
                serializerProvider.InstalledSerializers )
{
    if ( serializerDescriptor.IsLoadable &&
         fileName.EndsWith(serializerDescriptor.DefaultFileExtension) )
    {   // The plug-in serializer and fileName extensions match.
        selectedPlugIn = serializerDescriptor;
        break; // foreach
    }
}

// If a match for a plug-in serializer was found,
// use it to output and store the document.
if (selectedPlugIn != null)
{
    Stream package = File.Create(fileName);
    SerializerWriter serializerWriter =
        serializerProvider.CreateSerializerWriter(selectedPlugIn,
                                                  package);
    IDocumentPaginatorSource idoc =
        flowDocument as IDocumentPaginatorSource;
    serializerWriter.Write(idoc.DocumentPaginator, null);
    package.Close();
    return true;
}

備註

printTicket 如果沒有慣用的列印設定,則可以是 null

這個方法不會驗證或修改 printTicket 特定 指定的 PrintQueue 。 如有需要,請使用 PrintQueue.MergeAndValidatePrintTicket 方法建立對指定的印表機有效的 PrintQueue 專用 PrintTicket

寫入作業的輸出 Stream 通常會指定為實作 之衍生類別 SerializerWriter 之建構函式的參數。

另請參閱

適用於

Write(FixedPage, PrintTicket)

在衍生類別中覆寫時,以同步方式將指定的 FixedPage 連同相關聯的 PrintTicket 一起寫入至序列化 Stream

public:
 abstract void Write(System::Windows::Documents::FixedPage ^ fixedPage, System::Printing::PrintTicket ^ printTicket);
public abstract void Write (System.Windows.Documents.FixedPage fixedPage, System.Printing.PrintTicket printTicket);
abstract member Write : System.Windows.Documents.FixedPage * System.Printing.PrintTicket -> unit
Public MustOverride Sub Write (fixedPage As FixedPage, printTicket As PrintTicket)

參數

fixedPage
FixedPage

要寫入序列化 Stream 的頁面。

printTicket
PrintTicket

fixedPage 內容的預設列印喜好設定。

範例

下列範例示範如何使用 Write(DocumentPaginator, PrintTicket) 方法將流程檔序列化至輸出檔案。

// Create a SerializerProvider for accessing plug-in serializers.
SerializerProvider serializerProvider = new SerializerProvider();

// Locate the serializer that matches the fileName extension.
SerializerDescriptor selectedPlugIn = null;
foreach ( SerializerDescriptor serializerDescriptor in
                serializerProvider.InstalledSerializers )
{
    if ( serializerDescriptor.IsLoadable &&
         fileName.EndsWith(serializerDescriptor.DefaultFileExtension) )
    {   // The plug-in serializer and fileName extensions match.
        selectedPlugIn = serializerDescriptor;
        break; // foreach
    }
}

// If a match for a plug-in serializer was found,
// use it to output and store the document.
if (selectedPlugIn != null)
{
    Stream package = File.Create(fileName);
    SerializerWriter serializerWriter =
        serializerProvider.CreateSerializerWriter(selectedPlugIn,
                                                  package);
    IDocumentPaginatorSource idoc =
        flowDocument as IDocumentPaginatorSource;
    serializerWriter.Write(idoc.DocumentPaginator, null);
    package.Close();
    return true;
}

備註

printTicket 如果沒有慣用的列印設定,則可以是 null

這個方法不會驗證或修改 printTicket 特定 指定的 PrintQueue 。 如有需要,請使用 PrintQueue.MergeAndValidatePrintTicket 方法建立對指定的印表機有效的 PrintQueue 專用 PrintTicket

寫入作業的輸出 Stream 通常會指定為實作 之衍生類別 SerializerWriter 之建構函式的參數。

另請參閱

適用於

Write(FixedDocument, PrintTicket)

在衍生類別中覆寫時,以同步方式將指定的 FixedDocument 連同相關聯的 PrintTicket 一起寫入至序列化 Stream

public:
 abstract void Write(System::Windows::Documents::FixedDocument ^ fixedDocument, System::Printing::PrintTicket ^ printTicket);
public abstract void Write (System.Windows.Documents.FixedDocument fixedDocument, System.Printing.PrintTicket printTicket);
abstract member Write : System.Windows.Documents.FixedDocument * System.Printing.PrintTicket -> unit
Public MustOverride Sub Write (fixedDocument As FixedDocument, printTicket As PrintTicket)

參數

fixedDocument
FixedDocument

要寫入序列化 Stream 的文件。

printTicket
PrintTicket

fixedDocument 內容的預設列印喜好設定。

範例

下列範例示範如何使用 Write(DocumentPaginator, PrintTicket) 方法將流程檔序列化至輸出檔案。

// Create a SerializerProvider for accessing plug-in serializers.
SerializerProvider serializerProvider = new SerializerProvider();

// Locate the serializer that matches the fileName extension.
SerializerDescriptor selectedPlugIn = null;
foreach ( SerializerDescriptor serializerDescriptor in
                serializerProvider.InstalledSerializers )
{
    if ( serializerDescriptor.IsLoadable &&
         fileName.EndsWith(serializerDescriptor.DefaultFileExtension) )
    {   // The plug-in serializer and fileName extensions match.
        selectedPlugIn = serializerDescriptor;
        break; // foreach
    }
}

// If a match for a plug-in serializer was found,
// use it to output and store the document.
if (selectedPlugIn != null)
{
    Stream package = File.Create(fileName);
    SerializerWriter serializerWriter =
        serializerProvider.CreateSerializerWriter(selectedPlugIn,
                                                  package);
    IDocumentPaginatorSource idoc =
        flowDocument as IDocumentPaginatorSource;
    serializerWriter.Write(idoc.DocumentPaginator, null);
    package.Close();
    return true;
}

備註

printTicket 如果沒有慣用的列印設定,則可以是 null

這個方法不會驗證或修改 printTicket 特定 指定的 PrintQueue 。 如有需要,請使用 PrintQueue.MergeAndValidatePrintTicket 方法建立對指定的印表機有效的 PrintQueue 專用 PrintTicket

寫入作業的輸出 Stream 通常會指定為實作 之衍生類別 SerializerWriter 之建構函式的參數。

另請參閱

適用於

Write(DocumentPaginator, PrintTicket)

在衍生類別中覆寫時,以同步方式將分頁內容連同相關聯的 PrintTicket 一起寫入至序列化 Stream

public:
 abstract void Write(System::Windows::Documents::DocumentPaginator ^ documentPaginator, System::Printing::PrintTicket ^ printTicket);
public abstract void Write (System.Windows.Documents.DocumentPaginator documentPaginator, System.Printing.PrintTicket printTicket);
abstract member Write : System.Windows.Documents.DocumentPaginator * System.Printing.PrintTicket -> unit
Public MustOverride Sub Write (documentPaginator As DocumentPaginator, printTicket As PrintTicket)

參數

documentPaginator
DocumentPaginator

文件分頁符號,用來定義要寫入序列化 Stream 的內容。

printTicket
PrintTicket

documentPaginator 內容的預設列印喜好設定。

範例

下列範例示範如何使用 Write(DocumentPaginator, PrintTicket) 方法將流程檔序列化至輸出檔案。

// Create a SerializerProvider for accessing plug-in serializers.
SerializerProvider serializerProvider = new SerializerProvider();

// Locate the serializer that matches the fileName extension.
SerializerDescriptor selectedPlugIn = null;
foreach ( SerializerDescriptor serializerDescriptor in
                serializerProvider.InstalledSerializers )
{
    if ( serializerDescriptor.IsLoadable &&
         fileName.EndsWith(serializerDescriptor.DefaultFileExtension) )
    {   // The plug-in serializer and fileName extensions match.
        selectedPlugIn = serializerDescriptor;
        break; // foreach
    }
}

// If a match for a plug-in serializer was found,
// use it to output and store the document.
if (selectedPlugIn != null)
{
    Stream package = File.Create(fileName);
    SerializerWriter serializerWriter =
        serializerProvider.CreateSerializerWriter(selectedPlugIn,
                                                  package);
    IDocumentPaginatorSource idoc =
        flowDocument as IDocumentPaginatorSource;
    serializerWriter.Write(idoc.DocumentPaginator, null);
    package.Close();
    return true;
}

備註

printTicket 如果沒有慣用的列印設定,則可以是 null

這個方法不會驗證或修改 printTicket 特定 指定的 PrintQueue 。 如有需要,請使用 PrintQueue.MergeAndValidatePrintTicket 方法建立對指定的印表機有效的 PrintQueue 專用 PrintTicket

寫入作業的輸出 Stream 通常會指定為實作 之衍生類別 SerializerWriter 之建構函式的參數。

另請參閱

適用於

Write(FixedDocumentSequence, PrintTicket)

在衍生類別中覆寫時,以同步方式將指定的 FixedDocumentSequence 連同相關聯的 PrintTicket 一起寫入至序列化 Stream

public:
 abstract void Write(System::Windows::Documents::FixedDocumentSequence ^ fixedDocumentSequence, System::Printing::PrintTicket ^ printTicket);
public abstract void Write (System.Windows.Documents.FixedDocumentSequence fixedDocumentSequence, System.Printing.PrintTicket printTicket);
abstract member Write : System.Windows.Documents.FixedDocumentSequence * System.Printing.PrintTicket -> unit
Public MustOverride Sub Write (fixedDocumentSequence As FixedDocumentSequence, printTicket As PrintTicket)

參數

fixedDocumentSequence
FixedDocumentSequence

此文件順序會定義要寫入序列化 Stream 的內容。

printTicket
PrintTicket

fixedDocumentSequence 內容的預設列印喜好設定。

範例

下列範例示範如何使用 Write(DocumentPaginator, PrintTicket) 方法將流程檔序列化至輸出檔案。

// Create a SerializerProvider for accessing plug-in serializers.
SerializerProvider serializerProvider = new SerializerProvider();

// Locate the serializer that matches the fileName extension.
SerializerDescriptor selectedPlugIn = null;
foreach ( SerializerDescriptor serializerDescriptor in
                serializerProvider.InstalledSerializers )
{
    if ( serializerDescriptor.IsLoadable &&
         fileName.EndsWith(serializerDescriptor.DefaultFileExtension) )
    {   // The plug-in serializer and fileName extensions match.
        selectedPlugIn = serializerDescriptor;
        break; // foreach
    }
}

// If a match for a plug-in serializer was found,
// use it to output and store the document.
if (selectedPlugIn != null)
{
    Stream package = File.Create(fileName);
    SerializerWriter serializerWriter =
        serializerProvider.CreateSerializerWriter(selectedPlugIn,
                                                  package);
    IDocumentPaginatorSource idoc =
        flowDocument as IDocumentPaginatorSource;
    serializerWriter.Write(idoc.DocumentPaginator, null);
    package.Close();
    return true;
}

備註

printTicket 如果沒有慣用的列印設定,則可以是 null

這個方法不會驗證或修改 printTicket 特定 指定的 PrintQueue 。 如有需要,請使用 PrintQueue.MergeAndValidatePrintTicket 方法建立對指定的印表機有效的 PrintQueue 專用 PrintTicket

寫入作業的輸出 Stream 通常會指定為實作 之衍生類別 SerializerWriter 之建構函式的參數。

另請參閱

適用於

Write(FixedPage)

在衍生類別中覆寫時,以同步方式將指定的 FixedPage 寫入至序列化 Stream

public:
 abstract void Write(System::Windows::Documents::FixedPage ^ fixedPage);
public abstract void Write (System.Windows.Documents.FixedPage fixedPage);
abstract member Write : System.Windows.Documents.FixedPage -> unit
Public MustOverride Sub Write (fixedPage As FixedPage)

參數

fixedPage
FixedPage

要寫入序列化 Stream 的頁面。

範例

下列範例示範如何使用 Write(DocumentPaginator, PrintTicket) 方法將流程檔序列化至輸出檔案。

// Create a SerializerProvider for accessing plug-in serializers.
SerializerProvider serializerProvider = new SerializerProvider();

// Locate the serializer that matches the fileName extension.
SerializerDescriptor selectedPlugIn = null;
foreach ( SerializerDescriptor serializerDescriptor in
                serializerProvider.InstalledSerializers )
{
    if ( serializerDescriptor.IsLoadable &&
         fileName.EndsWith(serializerDescriptor.DefaultFileExtension) )
    {   // The plug-in serializer and fileName extensions match.
        selectedPlugIn = serializerDescriptor;
        break; // foreach
    }
}

// If a match for a plug-in serializer was found,
// use it to output and store the document.
if (selectedPlugIn != null)
{
    Stream package = File.Create(fileName);
    SerializerWriter serializerWriter =
        serializerProvider.CreateSerializerWriter(selectedPlugIn,
                                                  package);
    IDocumentPaginatorSource idoc =
        flowDocument as IDocumentPaginatorSource;
    serializerWriter.Write(idoc.DocumentPaginator, null);
    package.Close();
    return true;
}

備註

寫入作業的輸出 Stream 通常會指定為實作 之衍生類別 SerializerWriter 之建構函式的參數。

另請參閱

適用於

Write(FixedDocumentSequence)

在衍生類別中覆寫時,以同步方式將指定的 FixedDocumentSequence 寫入至序列化 Stream

public:
 abstract void Write(System::Windows::Documents::FixedDocumentSequence ^ fixedDocumentSequence);
public abstract void Write (System.Windows.Documents.FixedDocumentSequence fixedDocumentSequence);
abstract member Write : System.Windows.Documents.FixedDocumentSequence -> unit
Public MustOverride Sub Write (fixedDocumentSequence As FixedDocumentSequence)

參數

fixedDocumentSequence
FixedDocumentSequence

此文件順序會定義要寫入序列化 Stream 的內容。

範例

下列範例示範如何使用 Write(DocumentPaginator, PrintTicket) 方法將流程檔序列化至輸出檔案。

// Create a SerializerProvider for accessing plug-in serializers.
SerializerProvider serializerProvider = new SerializerProvider();

// Locate the serializer that matches the fileName extension.
SerializerDescriptor selectedPlugIn = null;
foreach ( SerializerDescriptor serializerDescriptor in
                serializerProvider.InstalledSerializers )
{
    if ( serializerDescriptor.IsLoadable &&
         fileName.EndsWith(serializerDescriptor.DefaultFileExtension) )
    {   // The plug-in serializer and fileName extensions match.
        selectedPlugIn = serializerDescriptor;
        break; // foreach
    }
}

// If a match for a plug-in serializer was found,
// use it to output and store the document.
if (selectedPlugIn != null)
{
    Stream package = File.Create(fileName);
    SerializerWriter serializerWriter =
        serializerProvider.CreateSerializerWriter(selectedPlugIn,
                                                  package);
    IDocumentPaginatorSource idoc =
        flowDocument as IDocumentPaginatorSource;
    serializerWriter.Write(idoc.DocumentPaginator, null);
    package.Close();
    return true;
}

備註

寫入作業的輸出 Stream 通常會指定為實作 之衍生類別 SerializerWriter 之建構函式的參數。

另請參閱

適用於

Write(FixedDocument)

在衍生類別中覆寫時,以同步方式將指定的 FixedDocument 寫入至序列化 Stream

public:
 abstract void Write(System::Windows::Documents::FixedDocument ^ fixedDocument);
public abstract void Write (System.Windows.Documents.FixedDocument fixedDocument);
abstract member Write : System.Windows.Documents.FixedDocument -> unit
Public MustOverride Sub Write (fixedDocument As FixedDocument)

參數

fixedDocument
FixedDocument

要寫入序列化 Stream 的文件。

範例

下列範例示範如何使用 Write(DocumentPaginator, PrintTicket) 方法將流程檔序列化至輸出檔案。

// Create a SerializerProvider for accessing plug-in serializers.
SerializerProvider serializerProvider = new SerializerProvider();

// Locate the serializer that matches the fileName extension.
SerializerDescriptor selectedPlugIn = null;
foreach ( SerializerDescriptor serializerDescriptor in
                serializerProvider.InstalledSerializers )
{
    if ( serializerDescriptor.IsLoadable &&
         fileName.EndsWith(serializerDescriptor.DefaultFileExtension) )
    {   // The plug-in serializer and fileName extensions match.
        selectedPlugIn = serializerDescriptor;
        break; // foreach
    }
}

// If a match for a plug-in serializer was found,
// use it to output and store the document.
if (selectedPlugIn != null)
{
    Stream package = File.Create(fileName);
    SerializerWriter serializerWriter =
        serializerProvider.CreateSerializerWriter(selectedPlugIn,
                                                  package);
    IDocumentPaginatorSource idoc =
        flowDocument as IDocumentPaginatorSource;
    serializerWriter.Write(idoc.DocumentPaginator, null);
    package.Close();
    return true;
}

備註

寫入作業的輸出 Stream 通常會指定為實作 之衍生類別 SerializerWriter 之建構函式的參數。

另請參閱

適用於

Write(DocumentPaginator)

在衍生類別中覆寫時,以同步方式將指定 DocumentPaginator 的內容寫入至序列化 Stream

public:
 abstract void Write(System::Windows::Documents::DocumentPaginator ^ documentPaginator);
public abstract void Write (System.Windows.Documents.DocumentPaginator documentPaginator);
abstract member Write : System.Windows.Documents.DocumentPaginator -> unit
Public MustOverride Sub Write (documentPaginator As DocumentPaginator)

參數

documentPaginator
DocumentPaginator

文件分頁符號,用來定義要寫入序列化 Stream 的內容。

範例

下列範例示範如何使用 Write(DocumentPaginator, PrintTicket) 方法將流程檔序列化至輸出檔案。

// Create a SerializerProvider for accessing plug-in serializers.
SerializerProvider serializerProvider = new SerializerProvider();

// Locate the serializer that matches the fileName extension.
SerializerDescriptor selectedPlugIn = null;
foreach ( SerializerDescriptor serializerDescriptor in
                serializerProvider.InstalledSerializers )
{
    if ( serializerDescriptor.IsLoadable &&
         fileName.EndsWith(serializerDescriptor.DefaultFileExtension) )
    {   // The plug-in serializer and fileName extensions match.
        selectedPlugIn = serializerDescriptor;
        break; // foreach
    }
}

// If a match for a plug-in serializer was found,
// use it to output and store the document.
if (selectedPlugIn != null)
{
    Stream package = File.Create(fileName);
    SerializerWriter serializerWriter =
        serializerProvider.CreateSerializerWriter(selectedPlugIn,
                                                  package);
    IDocumentPaginatorSource idoc =
        flowDocument as IDocumentPaginatorSource;
    serializerWriter.Write(idoc.DocumentPaginator, null);
    package.Close();
    return true;
}

備註

寫入作業的輸出 Stream 通常會指定為實作 之衍生類別 SerializerWriter 之建構函式的參數。

另請參閱

適用於

Write(Visual)

在衍生類別中覆寫時,以同步方式將指定的 Visual 元素寫入至序列化 Stream

public:
 abstract void Write(System::Windows::Media::Visual ^ visual);
public abstract void Write (System.Windows.Media.Visual visual);
abstract member Write : System.Windows.Media.Visual -> unit
Public MustOverride Sub Write (visual As Visual)

參數

visual
Visual

要寫入序列化 StreamVisual 項目。

範例

下列範例示範如何使用 Write(DocumentPaginator, PrintTicket) 方法將流程檔序列化至輸出檔案。

// Create a SerializerProvider for accessing plug-in serializers.
SerializerProvider serializerProvider = new SerializerProvider();

// Locate the serializer that matches the fileName extension.
SerializerDescriptor selectedPlugIn = null;
foreach ( SerializerDescriptor serializerDescriptor in
                serializerProvider.InstalledSerializers )
{
    if ( serializerDescriptor.IsLoadable &&
         fileName.EndsWith(serializerDescriptor.DefaultFileExtension) )
    {   // The plug-in serializer and fileName extensions match.
        selectedPlugIn = serializerDescriptor;
        break; // foreach
    }
}

// If a match for a plug-in serializer was found,
// use it to output and store the document.
if (selectedPlugIn != null)
{
    Stream package = File.Create(fileName);
    SerializerWriter serializerWriter =
        serializerProvider.CreateSerializerWriter(selectedPlugIn,
                                                  package);
    IDocumentPaginatorSource idoc =
        flowDocument as IDocumentPaginatorSource;
    serializerWriter.Write(idoc.DocumentPaginator, null);
    package.Close();
    return true;
}

備註

寫入作業的輸出 Stream 通常會指定為實作 之衍生類別 SerializerWriter 之建構函式的參數。

另請參閱

適用於