DocumentViewer上的FlowDocument [英] FlowDocument on DocumentViewer

查看:160
本文介绍了DocumentViewer上的FlowDocument的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将一个Coded [手段,由C#源代码制作] FlowDocument加载到DocumentViewer

I have to load a Coded[means, making by C# source code] FlowDocument to DocumentViewer

reportView.Document = null;

Matrix rpt = new Matrix(); // This is my FlowDocument

try
{
    reportView.Document = rpt; //This part always throws an exception
    //Exception: DocumentViewer supports only FixedDocument or             FixedDocumentSequence documents.
}
catch { }



即使抛出异常,如果我们在Page_Load上调用它,它也可以很好地工作并加载文档.

但是在Button_Click()上不起作用"

我找不到DocumentViewer的任何刷新功能.
Invalidate ...()-函数无济于事.

我正在研究为什么DocumentViewer在设置为Page_Load()而不是Button_Click()时显示FlowDocument的原因.



Even though it throw exception this works fine and load the document, if we call it on Page_Load.

"But its not working on a Button_Click()"

I couldn''t find any refresh function for DocumentViewer.
Invalidate...() - functions not helping.

I am digging into the reason why the DocumentViewer showing the the FlowDocument while we set at Page_Load() and not at Button_Click().

Have any Idea?

推荐答案

异常消息告诉您需要一些内容来查看流文档,而不是固定文档....可以使用FlowDocumentScrollViewer,FlowDocumentPageViewer或FlowDocumentReader?
The exception message kind of tells you that you need something to view a flowdocument, not a fixeddocument....maybe use a FlowDocumentScrollViewer, FlowDocumentPageViewer, or FlowDocumentReader?


这篇关于DocumentViewer上的FlowDocument的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆