flowdocument

FlowDocument Memory Issue in C#

南楼画角 提交于 2019-11-30 15:07:33
问题 I am currently attempting to deal with an issue with releasing a FlowDocument resources. I am loading an rtf file and putting it into a FlowDocument with TextRange.Load. I noticed that after it does this it holds onto those resources and GC doesn't collect it. I have ran a memory profiler and have seen that this is true. I have also narrowed it down to were I load actually put the rtf into the FlowDocument. If I dont do that, then everything is ok. So I know this is the issue. I am hoping for

How to convert FlowDocument to FixedDocument using FlowDocument's IDocumentPaginatorSource DocumentPaginator?

非 Y 不嫁゛ 提交于 2019-11-30 14:17:09
问题 I have: DocumentPaginator dp = ((IDocumentPaginatorSource)document).DocumentPaginator; and: FlowDocument document = new FlowDocument(); // create a flow document... How do a convert the FlowDocument to a FixedDocument using the DocumentPaginator? I can't seem to find out how to do this. All sites I looked at use XpsWriter as in: XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(xpsDoc); DocumentPaginator dp = ((IDocumentPaginatorSource)document).DocumentPaginator; writer.Write(dp

FlowDocument Memory Issue in C#

泪湿孤枕 提交于 2019-11-30 13:40:56
I am currently attempting to deal with an issue with releasing a FlowDocument resources. I am loading an rtf file and putting it into a FlowDocument with TextRange.Load. I noticed that after it does this it holds onto those resources and GC doesn't collect it. I have ran a memory profiler and have seen that this is true. I have also narrowed it down to were I load actually put the rtf into the FlowDocument. If I dont do that, then everything is ok. So I know this is the issue. I am hoping for some guidance to what how I can solve this problem. Here is the code that loads the rtf and everything

How to convert FlowDocument to FixedDocument using FlowDocument's IDocumentPaginatorSource DocumentPaginator?

核能气质少年 提交于 2019-11-30 10:00:27
I have: DocumentPaginator dp = ((IDocumentPaginatorSource)document).DocumentPaginator; and: FlowDocument document = new FlowDocument(); // create a flow document... How do a convert the FlowDocument to a FixedDocument using the DocumentPaginator? I can't seem to find out how to do this. All sites I looked at use XpsWriter as in: XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(xpsDoc); DocumentPaginator dp = ((IDocumentPaginatorSource)document).DocumentPaginator; writer.Write(dp); I could write the XPS and then get back the FixedDocument but there must be a better way? No, there

C# FlowDocument to HTML conversion

时光总嘲笑我的痴心妄想 提交于 2019-11-30 07:25:34
Basically, I have a RichTextBox and I want to convert the formatted contents of it to HTML so it can be sent as an email. The method I am currently using does not give any formatting at all: string message = new TextRange(messageTextBox.Document.ContentStart, messageTextBox.Document.ContentEnd).Text; So I searched around and found this , however, it is over 5 years old and in the comments an MSFT user has commented saying that it is no longer supported - "This sample has been removed from our sample set and is no longer supported" , and the HTML it generates is in an older format than modern

WPF Table Column Sizes

别等时光非礼了梦想. 提交于 2019-11-30 06:36:10
I'm rendering a Table in a WPF FlowDocument using code-behind. But, I've been unable to find an example that shows how to make the table use only the space needed based on content . Instead the table takes up all available width, which I don't want, nor do I want to have to specify a exact pixel sizes. I'm clearly missing something simple, anyone see it? var fd = new FlowDocument(); Table t = new Table(); t.BorderBrush = Brushes.Black; t.BorderThickness = new Thickness(2); // I thought this would do what I wanted... t.Columns.Add(new TableColumn() { Width = GridLength.Auto }); t.Columns.Add

Repeating databound item in WPF FlowDocument

允我心安 提交于 2019-11-30 05:45:41
问题 I have a flowdocument in WPF that looks like this: <FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Paragraph FontFamily="Georgia"> <StackPanel> <TextBlock Text="{Binding Path=Title}"/> <TextBlock Text="{Binding Path=AssignedTo}"/> </StackPanel> </Paragraph> </FlowDocument> instead of giving the DataContext a class with the Title and AssignedTo property, I would like to give it a List of that class and

Defining where on the page the flowdocument I am printing will 'start' and 'end'

◇◆丶佛笑我妖孽 提交于 2019-11-30 05:13:55
问题 I am almost done with implementing a printing functionality, but I am having trouble getting the last hurdle done with. My problem is, that I am printing some reports, consisting of a header (with information about the person the report is about), a footer (with a page number) and the content in the middle, which is a FlowDocument. Since the flowdocuments can be fairly long, It is very possible that they will span multiple pages. My approach is to make a custom FlowDocumentPaginator which

Scroll a WPF FlowDocumentScrollViewer from code?

为君一笑 提交于 2019-11-30 03:40:49
问题 I have a FlowDocumentScrollViewer I want to automatically scroll to the bottom when text is added. <FlowDocumentScrollViewer Name="Scroller"> <FlowDocument Foreground="White" Name="docDebug" FontFamily="Terminal"> <Paragraph Name="paragraphDebug"/> </FlowDocument> </FlowDocumentScrollViewer> In code I add Inlines to the Paragraph, but when there is to much text I would like to be able to simply scroll down using code instead of having the user doing so. Any suggestions? 回答1: The other answers

Handle all Hyperlinks MouseEnter event in a loaded loose Flowdocument

て烟熏妆下的殇ゞ 提交于 2019-11-29 15:22:59
I'm new to WPF, working on my first project. I've been stuck in this problem for a week so I'm trying to find some help here. I have a FlowDocumentReader inside my app, wich loads several FlowDocuments (independent files as loose xaml files). I need to handle the MouseEnter event for all the Hyperlinks in the loaded document but I cannot set MouseEnter="myHandler" in XAML as theese are loose XAML files. Is there any way to parse de FlowDocument and set the handlers when loading it? Any other solution? Sorry for the Newbie question, thanks A LOT in advance. After loading your FlowDocument you