我们正在开发基于C# .net 4.0 Windows Form的应用程序。在这里,用户将输入获得段落编号的Word文档段落number.After,我想在任何一个字处理组件中显示选定的段落,如Dsoframer或任何其他而不更改格式。我是怎么做的?
使用DSOFRAMER,我可以打开整个单词Document.but,我只想显示用户选择的段落……
(或)
我能够检索用户选择的Word文档的open xml表示(使用OPEN XML SDK2.0).Then如何将其粘贴到任何字处理组件中。
发布于 2011-06-01 18:40:39
Object fileName = "C:\\Documents and Settings\\saravanan\\Desktop\\test1.docx";
axFramerControl1.Open(fileName, true, 0, "", "");
Microsoft.Office.Interop.Word.Document wordDoc = Microsoft.Office.Interop.Word.Document)axFramerControl1.ActiveDocument;
Microsoft.Office.Interop.Word.Application wordApp = wordDoc.Application;
Microsoft.Office.Interop.Word.Range r = wordDoc.Paragraphs[15].Range;
//object dir = Microsoft.Office.Interop.Word.WdCollapseDirection.wdCollapseStart;
//r.Collapse(ref dir);
r.Select();这将显示文档的第15段和选择范围...
https://stackoverflow.com/questions/6149117
复制相似问题