gpt4 book ai didi

.net - 在 DocumentViewer 中显示多个 FixedDocuments,就好像它们是单个文档一样

转载 作者:行者123 更新时间:2023-12-04 06:27:45 24 4
gpt4 key购买 nike

在我的 WPF 应用程序中,我有几个 FixedDocument 对象,我想将它们一起显示在 DocumentViewer 中,就好像它们是单个文档一样。

在文档查看器中显示单个 FixedDocument 很容易:

myDocumentViewer.Document = myFixedDocument;

我的第一个想法是为我的所有 FixedDocuments 创建一个 FixedDocumentSequence(它也可以设置为 DocumentViewer.Document 值,因为它实现了 IDocumentPaginatorSource)。但是在构建 FixedDocumentSequence 时,只能添加到 DocumentReference 对象的集合中。没有直接添加 FixedDocument 的直接方法,我无法弄清楚如何创建和添加以某种方式链接到我的 FixedDocument 之一的 DocumentReference。

我的第二个想法是创建一个主固定文档,然后遍历所有固定文档,并将它们的页面移动到主固定文档中。但是我在尝试这样做时遇到了各种各样的问题(与已经属于另一个文档的页面有关(无法从该文档中删除它们!等等)

我的第三个想法是创建和构建临时 XpsDocument,并检索它似乎自动创建的 FixedDocumentSequence。我已经看过了一点,但感觉越来越复杂,所以我想我会先在这里发帖看看是否还有其他想法,或者帮助我的前两次尝试!

最佳答案

弄清楚了。

事实上,您可以动态创建链接到 FixedDocuments 的 DocumentReference 对象:

var documentReference = new DocumentReference();
documentReference.SetDocument(document);
fixedDocumentSequence.References.Add(documentReference);

我不太确定我是如何错过 SetDocument方法之前。我想我一定是在找 DocumentReference.Document带有 getter/setter 的属性。在我看来,在 .NET 框架中使用 GetDocument 和 SetDocument 方法有点不一致。

关于.net - 在 DocumentViewer 中显示多个 FixedDocuments,就好像它们是单个文档一样,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5831622/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com