问题标签 [fixeddocumentsequence]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
6506 浏览

data-binding - 为什么我在打印到 XpsDocument 时丢失了数据绑定?

更新!

装订工作。问题是 XpsDocumentWriter 没有正确写入 FixedDocumentSequence 的第一个文档的第一页。这似乎是很多人在做这种事情时遇到的问题(即全球有五个开发人员)。解决方案有点奇怪。我把它作为一个答案。


好的,它比问题所暗示的要微妙一些。

我有一系列 FixedPages,每个都有其 DataContext 单独设置。每个 FixedPage 还具有一个或多个绑定到上下文的控件。

如果我将这些 FixedPages 添加到单个 FixedDocument 并将此单个 FixedDocument 写入 XpsDocument,我的绑定将被取消引用(可以这么说)并且正确的值会显示在 XpsDocument 中。

如果我将这些 FixedPages 添加到各个 FixedDocuments(每个 FP 被添加到一个新的 FD),然后这些 FixedDocuments 被添加到一个 FixedDocumentSequence,然后这个序列被写入 XpsDocument,我的绑定不会被取消引用并且我的 FixedPages 显示为空白.

调试告诉我我没有丢失我的绑定或我的绑定上下文,所以这不是这个失败的原因。

下面是一些示例代码来说明发生了什么:

您可以看到两者之间的唯一区别是我将固定文档添加到固定文档序列中,然后将其写入。

显然,当我的固定文档未写入 Xps 文档时,不会发生任何导致评估数据绑定和插入绑定值的魔法。我需要能够编写多个固定文档,并且 Write 方法只能调用一次,因此需要我将 FixedDocuments 添加到我然后编写的 FixedDocumentSequence 中。但我需要我该死的数据绑定才能工作!

在这种情况下的任何帮助将不胜感激。我知道它不完全是框架中最常见的部分。我只是希望这里有人对此有一些操作经验(我在看着你,潜伏着 MS 员工)。

0 投票
2 回答
2140 浏览

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

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

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

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

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

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

0 投票
0 回答
231 浏览

wpf - Generating Print ready contents with WPF with paper precision

I am new to WPF and c# as a whole. I have experience from programming language like PHP, HTML and Javascript so I was able to cope quickly.

I have a project that is used to print PINs and Serial Number on a card. Let say the card is A4 and on the paper there are 4 rows and 3 columns of printed cards.

My problem is, I dont really know how to generate the dynamic document and the approach to use. Since the content is not that I have to just make it available on the paper before hand, it has to be placed on a particular position on the paper. Inches calculation will strictly be adhered to.

The link below illustrates an explanation of what I am talking about with border exclusive. All I want to generate is the PIN and serial in this way on a specific paper size.

http://ecloudpack.com/grid.png

Dont get me wrong, speaking of flowDocuments, I think I can bring out something but I am faced with the challenge of precision of position on the paper and making sure the pagination is correct and making sure the margin as specified is what is generated.

I have a Monday deadline and I have been trying.

Is there anyone that can help.