c# - Read dox,docx files with the same style -
i use below code read doc,docx files , show them in richtextbox way can't show files same style.for example if text red color richtextbox show black color should ?
microsoft.office.interop.word.application app = new microsoft.office.interop.word.applicationclass(); object nullobj = system.reflection.missing.value; object file = openfiledialog1.filename; microsoft.office.interop.word.document doc = app.documents.open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj); doc.activewindow.selection.wholestory(); doc.activewindow.selection.copy(); idataobject data = clipboard.getdataobject(); string text = data.getdata(dataformats.text).tostring(); console.writeline(text); doc.close(ref nullobj, ref nullobj, ref nullobj); app.quit(ref nullobj, ref nullobj, ref nullobj); richtextbox1.text = text;
i think out of luck in case.
richtextbox near powerful word. if were, make copies of word , ms loose money.
you may working partially (like did). never enough.
Comments
Post a Comment