WPF将流程文档导出到Word中 [英] Wpf Exporting flow document into word
问题描述
嗨
我在wpf中有一个流程文档,其设计如下(xaml).
< flowdocumentreader x:name ="flowReader" xmlns:x =#unknown">
HorizontalAlignment ="Stretch" VerticalAlignment ="Stretch"
ScrollViewer.VerticalScrollBarVisibility ="Auto" ViewingMode ="Scroll">
< flowdocument name ="flownew">
我已经尝试过使用代码,但事实是只有段落标题才导出为word,而我还需要显示其内容.
使用(FileStream fs = new FileStream("D:\\ test.rtf",FileMode.OpenOrCreate,FileAccess.ReadWrite))
{
TextRange textRange =新的TextRange(flowReader.Document.ContentStart,flowReader.Document.ContentEnd);
textRange.Save(fs,DataFormats.Rtf);
}
谁能帮我将流程文档导出为包含所有内容的Word文档.
Hi
I have a flow document in wpf which is designed as below(xaml).
<flowdocumentreader x:name="flowReader" xmlns:x="#unknown">
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
ScrollViewer.VerticalScrollBarVisibility="Auto" ViewingMode="Scroll">
<flowdocument name="flownew">
I have tried with the code but the thing is only paragraph headers are exporting into word instead i need to show its content also.
using (FileStream fs = new FileStream("D:\\test.rtf", FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
TextRange textRange = new TextRange(flowReader.Document.ContentStart, flowReader.Document.ContentEnd);
textRange.Save(fs, DataFormats.Rtf);
}
Can any one please help me to export the flow document into word document with all the content.
推荐答案
请参阅我对问题的评论.对于基本概念,请参阅我过去的答案:
无需互操作即可将Office文档转换为PDF [我如何显示单词Windows应用程序中使用c#.net [
Please see my comment to the question. For the basic idea, please see my past answers:
Convert Office-Documents to PDF without interop[^],
Hi how can i display word file in windows application using c#.net[^].
—SA
这篇关于WPF将流程文档导出到Word中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!