【问题标题】:Custom DocumentPaginator and DocumentViewer WPF自定义 DocumentPaginator 和 DocumentViewer WPF
【发布时间】:2013-02-18 13:46:09
【问题描述】:

我有一个自定义的DocumentPaginator,它会创建一个包含一些值的表格,并在每一页的开头重复表格标题。 (类似于here。) 如何在DocumentViewr 中显示由它生成的页面?

我相信首先我需要创建一个XpsDocument。 所以我尝试使用XpsDocumentWriter

var xpsw = XpsDocument.CreateXpsDocumentWriter(xpsDocument);
xpsw.Write(paginator);

但它不起作用。 有人知道怎么做吗?

【问题讨论】:

  • 但它不起作用。嗯,这当然是信息。顺便说一句,分页是hard。有很多事情可能会出错,并且有很多原因。如果您无法缩小问题范围或更详细地提出问题,您可能不会得到答案。
  • 它崩溃了,但有以下例外:“FixedDocument 必须至少包含一个 FixedPage。”。上线:xpsw.Write(paginator);.
  • 好吧,分页器没有提供任何实际的FixedPages。但是,不知道为什么。进行一些调试可能会有所帮助。
  • 谢谢你,威尔。问题是 PageCount 没有正确实现。
  • 您可以提供解决方案的(至少几段)描述并关闭问题,然后您可以关闭它。不是必需的,但it can help your account's status.

标签: c# wpf pagination documentviewer xpsdocument


【解决方案1】:

原来Paginator.PageCount 覆盖的属性没有正确实现。 它曾经返回一个负数,因此Paginator.GetPage 方法无法提供任何页面。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-25
    • 2010-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-03
    • 2023-03-16
    • 1970-01-01
    相关资源
    最近更新 更多