本文整理汇总了C#中System.Windows.Xps.Packaging.IXpsFixedDocumentSequenceWriter.Commit方法的典型用法代码示例。如果您正苦于以下问题:C# IXpsFixedDocumentSequenceWriter.Commit方法的具体用法?C# IXpsFixedDocumentSequenceWriter.Commit怎么用?C# IXpsFixedDocumentSequenceWriter.Commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Xps.Packaging.IXpsFixedDocumentSequenceWriter
的用法示例。
在下文中一共展示了IXpsFixedDocumentSequenceWriter.Commit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPackageContent
// ------------------------- 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)
{
try
{
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 =
xpsDocument.AddFixedDocumentSequence();
// Add the 1st FixedDocument to the FixedDocumentSequence. - - - - -
IXpsFixedDocumentWriter fixedDocumentWriter =
documentSequenceWriter.AddFixedDocument();
// Add content to the 1st document
AddDocumentContent(fixedDocumentWriter);
// Commit the 1st Document
fixedDocumentWriter.Commit();
// Add a 2nd FixedDocument to the FixedDocumentSequence. - - - - - -
fixedDocumentWriter = documentSequenceWriter.AddFixedDocument();
// Add content to the 2nd document.
AddDocumentContent(fixedDocumentWriter);
// If attaching PrintTickets, attach one at the FixedDocument level.
if (attachPrintTicket)
fixedDocumentWriter.PrintTicket = printTicket;
// Commit the 2nd document.
fixedDocumentWriter.Commit();
// If attaching PrintTickets, attach one at
// the package FixedDocumentSequence level.
if (attachPrintTicket)
documentSequenceWriter.PrintTicket = printTicket;
// Commit the FixedDocumentSequence
documentSequenceWriter.Commit();
}
catch (XpsPackagingException xpsException)
{
throw xpsException;
}
}// end:AddPackageContent()