flowdocument

Highlight parts of text in FlowDocument

喜夏-厌秋 提交于 2019-12-22 08:22:19
问题 I want to highlight some parts of text in a FlowDocument based on the search results. What I am doing is getting the indexes where the searched word occures in the text of the FlowDocument and then apply background color on the text range starting at the found index, ending at the found index + search word length. TextRange content = new TextRange(myFlowDocument.ContentStart, myFlowDocument.ContentEnd); List<int> highlights = GetHighlights(content.Text, search); foreach (int index in

Convert XAML to FlowDocument to display in RichTextBox in WPF

南楼画角 提交于 2019-12-21 18:37:13
问题 I have some HTML, which i am converting to XAML using the library provided by Microsoft string t = HtmlToXamlConverter.ConvertHtmlToXaml(mail.HtmlDataString,true); now, from How to insert XAML into RichTextBox? i am using the following: private static FlowDocument SetRTF(string xamlString) { StringReader stringReader = new StringReader(xamlString); System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(stringReader); Section sec = XamlReader.Load(xmlReader) as Section; FlowDocument doc

Convert XAML to FlowDocument to display in RichTextBox in WPF

风格不统一 提交于 2019-12-21 18:36:59
问题 I have some HTML, which i am converting to XAML using the library provided by Microsoft string t = HtmlToXamlConverter.ConvertHtmlToXaml(mail.HtmlDataString,true); now, from How to insert XAML into RichTextBox? i am using the following: private static FlowDocument SetRTF(string xamlString) { StringReader stringReader = new StringReader(xamlString); System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(stringReader); Section sec = XamlReader.Load(xmlReader) as Section; FlowDocument doc

How can we show .rtf or .doc as flowdocument in WPF?

不想你离开。 提交于 2019-12-21 11:32:12
问题 It is for the help section of the application. I am thinking to put flowdocumentReader to show the help document. But is it possible to show .rtf or any .doc to show in Flowdocument.Or is it neccesary to create a flow document in Xaml. Please help. Thanks, 回答1: Something on these lines will do the job for you where documentPath is your rtf file path: FileStream fileStream = File.Open(documentPath, FileMode.Open, FileAccess.Read, FileShare.Read); FlowDocument flowDocument = new FlowDocument();

What's the best way to convert a FlowDocument into PDF

不羁岁月 提交于 2019-12-20 10:47:10
问题 How would ya'll recommend that I convert a FlowDocument to PDF to be attached to an EMail? The FlowDocument is dynamic, not static. I would prefer to be able to store the PDF in memory as a byte[], rather than on disk, but that is negotiable. Thanks for your help! 回答1: You have two options that I know of. The first is to use a proprietary library called NiPDF, alternatively you can use Word Interop. Save the FlowDocument to a DOCX file using Open XML SDK Use Word Interop to load the saved

WPF Flowdocument “change case” feature

醉酒当歌 提交于 2019-12-19 11:52:36
问题 I am implementing a "change case" functionality for my RichTextBox like word has with Shift+F3. All it does is switching between lower->upper->title case, which is very simple once I get access to the string I need. My question is, how to change (and find it in the first place) a string in flowdocument without losing any embedded elements (losing formatting is not a problem) that may be contained within the string. Same as word, I need this functionality for 2 cases: 1) Mouse-selected text. I

WPF FlowDocument Table - AutoFit option?

旧时模样 提交于 2019-12-19 08:22:35
问题 I want a table to logically size the columns according to the contents. Is this possible in WPF? alt text http://img43.imageshack.us/img43/2640/flowdocument.jpg Here is the code I'm working with: <Window x:Class="FlowDocument.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Window.Resources> <Style TargetType="{x:Type TableCell}"> <Setter Property="BorderBrush" Value=

WPF FlowDocument Table - AutoFit option?

泪湿孤枕 提交于 2019-12-19 08:22:08
问题 I want a table to logically size the columns according to the contents. Is this possible in WPF? alt text http://img43.imageshack.us/img43/2640/flowdocument.jpg Here is the code I'm working with: <Window x:Class="FlowDocument.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Window.Resources> <Style TargetType="{x:Type TableCell}"> <Setter Property="BorderBrush" Value=

WPF: flowdocument to PDF [closed]

断了今生、忘了曾经 提交于 2019-12-18 18:02:20
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . hI, Is there any control that prints flow document content to PDF? EDIT: not a 3rd party control Thank you 回答1: I was able to solve my problem by saving the flowdocument content to .DOCX and converting it to PDF by using Microsoft.Office.Interop.Word using moiw = Microsoft.Office.Interop.Word; public static void

How to set the original width of a WPF FlowDocument

蹲街弑〆低调 提交于 2019-12-18 07:04:08
问题 I have this XAML structure: <wft:Dialog x:Class="WFT.PumpSvc.Bench.Parts.PartsPullListDialog" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wft="http://schemas.Weatherford.com"> <wft:Dialog.Resources> <ResourceDictionary Source="../Resources.xaml" /> </wft:Dialog.Resources> <wft:CaptionedBox Style="{StaticResource HeaderCaptionedBox}" Name="captionedBox" Caption="Parts Pull List"> <DockPanel> <DockPanel DockPanel