This documentation is archived and is not being maintained.

XpsDocument.AddFixedDocumentSequence Method

Adds a root FixedDocumentSequence to the package and returns a writer.

Namespace: System.Windows.Xps.Packaging
Assembly: ReachFramework (in reachframework.dll)

public IXpsFixedDocumentSequenceWriter AddFixedDocumentSequence ()
public IXpsFixedDocumentSequenceWriter AddFixedDocumentSequence ()
public function AddFixedDocumentSequence () : IXpsFixedDocumentSequenceWriter
You cannot use methods in XAML.

Return Value

The XML Paper Specification (XPS) fixed-document sequence writer for this XpsDocument.

Although this class uses a singular name, an XpsDocument can be a set (sequence) of one FixedDocument or multiple documents.

The following example shows how to use the AddFixedDocumentSequence method to insert content into an XpsDocument.

// ------------------------- AddPackageContent ----------------------------
/// <summary>
///   Adds a predefined set of content to a given XPS document.</summary>
/// <param name="xpsDocument">
///   The package to add the document content to.</param>
/// <param name="attachPrintTicket">
///   true to include a PrintTicket with the
///   document; otherwise, false.</param>
private void AddPackageContent(
    XpsDocument xpsDocument, bool attachPrintTicket)
        PrintTicket printTicket = GetPrintTicketFromPrinter();
        // PrintTicket is null, there is no need to attach one.
        if (printTicket == null)
            attachPrintTicket = false;

        // Add a FixedDocumentSequence at the Package root
        IXpsFixedDocumentSequenceWriter documentSequenceWriter =

        // Add the 1st FixedDocument to the FixedDocumentSequence. - - - - -
        IXpsFixedDocumentWriter fixedDocumentWriter =

        // Add content to the 1st document

        // Commit the 1st Document

        // Add a 2nd FixedDocument to the FixedDocumentSequence. - - - - - -
        fixedDocumentWriter = documentSequenceWriter.AddFixedDocument();

        // Add content to the 2nd document.

        // If attaching PrintTickets, attach one at the FixedDocument level.
        if (attachPrintTicket)
            fixedDocumentWriter.PrintTicket = printTicket;

        // Commit the 2nd document.

        // If attaching PrintTickets, attach one at
        // the package FixedDocumentSequence level.
        if (attachPrintTicket)
            documentSequenceWriter.PrintTicket = printTicket;

        // Commit the FixedDocumentSequence
    catch (XpsPackagingException xpsException)
        throw xpsException;
}// end:AddPackageContent()

For the complete sample, see Creating an XPS Document Sample.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0