load word file (.docx) in richtextbox

后端 未结 2 1360
無奈伤痛
無奈伤痛 2021-01-24 10:08

I was already able to load a .docx file into my wpf application but it doesn\'t seem to show up in my richtextbox:

if (openFile.ShowDialog() == true)
{
     // O         


        
2条回答
  •  感动是毒
    2021-01-24 10:36

    That code shouldn't compile, RichTextBox.Document is of type FlowDocument, and you are assigning it to a string.

    Maybe you should look for ways to convert a .docx file to a FlowDocument you can assign to the RichTextBox.

    There is a popular tool you can use which is called: Word to XAML

    Another options are:

    • OpenXML + FlowDocument = OpenFlowDocument?
    • Show Word file in WPF

提交回复
热议问题