Udostępnij za pośrednictwem


IXpsFixedPageWriter Interfejs

Definicja

Definiuje metody pisania FixedPage części w dokumencie XPS.

public interface class IXpsFixedPageWriter : System::Windows::Xps::Packaging::IStoryFragmentProvider
public interface IXpsFixedPageWriter : System.Windows.Xps.Packaging.IStoryFragmentProvider
type IXpsFixedPageWriter = interface
    interface IStoryFragmentProvider
Public Interface IXpsFixedPageWriter
Implements IStoryFragmentProvider
Implementuje

Przykłady

W poniższym przykładzie pokazano, jak za pomocą AddFixedPage metody uzyskać składnik zapisywania stałej strony na potrzeby dodawania stron do obiektu XpsDocument.

// ------------------------- AddDocumentContent ---------------------------
/// <summary>
///   Adds a predefined set of content to a given document writer.</summary>
/// <param name="fixedDocumentWriter">
///   The document writer to add the content to.</param>
void AddDocumentContent (IXpsFixedDocumentWriter^ fixedDocumentWriter)
{
   // Collection of image and font resources used on the current page.
   //   Key: "XpsImage", "XpsFont"
   //   Value: List of XpsImage or XpsFont resources
   Dictionary<System::String^,List<XpsResource^>^>^ resources;

   try
   {
      // Add Page 1 to current document.
      IXpsFixedPageWriter^ fixedPageWriter = fixedDocumentWriter->AddFixedPage();
      // Add the resources for Page 1 and get the resource collection.
      resources = AddPageResources(fixedPageWriter);

      // Write page content for Page 1.
      WritePageContent(fixedPageWriter->XmlWriter, "Page 1 of " + fixedDocumentWriter->Uri->ToString(), resources);
      // Commit Page 1.
      fixedPageWriter->Commit();

      // Add Page 2 to current document.
      fixedPageWriter = fixedDocumentWriter->AddFixedPage();

      // Add the resources for Page 2 and get the resource collection.
      resources = AddPageResources(fixedPageWriter);

      // Write page content to Page 2.
      WritePageContent(fixedPageWriter->XmlWriter, "Page 2 of " + fixedDocumentWriter->Uri->ToString(), resources);
      // Commit Page 2.
      fixedPageWriter->Commit();
   } catch (XpsPackagingException^ xpsException)
   {
      throw xpsException;

   }
};// end:AddDocumentContent()
// ------------------------- AddDocumentContent ---------------------------
/// <summary>
///   Adds a predefined set of content to a given document writer.</summary>
/// <param name="fixedDocumentWriter">
///   The document writer to add the content to.</param>
private void AddDocumentContent(IXpsFixedDocumentWriter fixedDocumentWriter)
{
    // Collection of image and font resources used on the current page.
    //   Key: "XpsImage", "XpsFont"
    //   Value: List of XpsImage or XpsFont resources
    Dictionary<string, List<XpsResource>> resources;

    try
    {
        // Add Page 1 to current document.
        IXpsFixedPageWriter fixedPageWriter =
            fixedDocumentWriter.AddFixedPage();

        // Add the resources for Page 1 and get the resource collection.
        resources = AddPageResources(fixedPageWriter);

        // Write page content for Page 1.
        WritePageContent(fixedPageWriter.XmlWriter,
            "Page 1 of " + fixedDocumentWriter.Uri.ToString(), resources);

        // Commit Page 1.
        fixedPageWriter.Commit();

        // Add Page 2 to current document.
        fixedPageWriter = fixedDocumentWriter.AddFixedPage();

        // Add the resources for Page 2 and get the resource collection.
        resources = AddPageResources(fixedPageWriter);

        // Write page content to Page 2.
        WritePageContent(fixedPageWriter.XmlWriter,
            "Page 2 of " + fixedDocumentWriter.Uri.ToString(), resources);

        // Commit Page 2.
        fixedPageWriter.Commit();
    }
    catch (XpsPackagingException xpsException)
    {
        throw xpsException;
    }
}// end:AddDocumentContent()
' ------------------------- AddDocumentContent ---------------------------
''' <summary>
'''   Adds a predefined set of content to a given document writer.</summary>
''' <param name="fixedDocumentWriter">
'''   The document writer to add the content to.</param>
Private Sub AddDocumentContent(ByVal fixedDocumentWriter As IXpsFixedDocumentWriter)
    ' Collection of image and font resources used on the current page.
    '   Key: "XpsImage", "XpsFont"
    '   Value: List of XpsImage or XpsFont resources
    Dim resources As Dictionary(Of String, List(Of XpsResource))

    Try
        ' Add Page 1 to current document.
        Dim fixedPageWriter As IXpsFixedPageWriter = fixedDocumentWriter.AddFixedPage()

        ' Add the resources for Page 1 and get the resource collection.
        resources = AddPageResources(fixedPageWriter)

        ' Write page content for Page 1.
        WritePageContent(fixedPageWriter.XmlWriter, "Page 1 of " & fixedDocumentWriter.Uri.ToString(), resources)

        ' Commit Page 1.
        fixedPageWriter.Commit()

        ' Add Page 2 to current document.
        fixedPageWriter = fixedDocumentWriter.AddFixedPage()

        ' Add the resources for Page 2 and get the resource collection.
        resources = AddPageResources(fixedPageWriter)

        ' Write page content to Page 2.
        WritePageContent(fixedPageWriter.XmlWriter, "Page 2 of " & fixedDocumentWriter.Uri.ToString(), resources)

        ' Commit Page 2.
        fixedPageWriter.Commit()
    Catch xpsException As XpsPackagingException
        Throw xpsException
    End Try
End Sub

Właściwości

LinkTargetStream

Pobiera listę ciągów identyfikujących LinkTarget punkty hiperłącza zawarte na bieżącej stronie.

PageNumber

Pobiera numer strony o zerowym numerze strony.

PrintTicket

Ustawia domyślne opcje drukowania dla strony.

Uri

Pobiera identyfikator URI stałej strony.

XmlWriter

Pobiera element do zapisywania XmlWriter znaczników XML na stronie.

Metody

AddColorContext()

Dodaje nowy XpsColorContext element do bieżącej strony.

AddFont()

Dodaje nowy XpsFont element do bieżącej strony.

AddFont(Boolean)

Dodaje nową zaciemnioną XpsFont do bieżącej strony.

AddFont(Boolean, Boolean)

Dodaje nową zaciemnioną lub ograniczoną XpsFont do bieżącej strony.

AddImage(String)

Dodaje nowy XpsImage z określonym typem MIME do bieżącej strony.

AddImage(XpsImageType)

Dodaje nowy XpsImage element z określonym XpsImageType elementem do bieżącej strony.

AddResource(Type, Uri)

Dodaje nowy XpsResource element do bieżącej strony.

AddResourceDictionary()

Dodaje element XpsResourceDictionary do strony.

AddStoryFragment()

StoryFragments Dodaje element do pakietu XPS.

(Odziedziczone po IStoryFragmentProvider)
AddThumbnail(XpsImageType)

Dodaje obraz miniatury określonego XpsImageType do bieżącej strony.

Commit()

Opróżnia i zamyka składnik zapisywania stałej strony.

Dotyczy

Zobacz też