Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

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.
Sergey Alexandrovich Kryukov 5-Nov-12 11:50am    
Word is proprietary; there is no "export", but you can write some custom code using Offce interop. Or learn the Word format. Why working with Word at all? I think this is a sign of user-level thinking, not programming.
ammuchinnu 6-Nov-12 5:21am    
Thanks for the reply.It is the requirement what we had.Just wanna confirm whether it can b possible or not.
Sergey Alexandrovich Kryukov 6-Nov-12 10:11am    
"Exporting"? Not exactly, because "export" implied that there is a unambiguous mapping. I think the problem is unambiguous, that is, you can feed on input the document, plus some particular mapping rules. Please see my answer.

1 solution

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[^].

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900