Aspose.word plugin download Link: http://pan.baidu.com/s/1qXIgOXY Password: wsj2
Use reason: No need to install Office, no compatibility issues, cracked version has certain limitations
Code:
public paragraphcollection wordparagraphs ( String FileName) {Document doc = new Document (fileName); if (Doc. FirstSection.Body.Paragraphs.Count > 0 return Doc. FirstSection.Body.Paragraphs; // word " return null ;}
Public string Getwordparagraphs (int index) { var phs = _word. Wordparagraphs (Server.MapPath (model. Wordfpath)); return Phs[i]. GetText ();}
Attached with Microsoft.Office.Interop.Word read paragraph (flexible but not resolved)
Public classwordhelper{Private_document doc =NULL; PublicWordhelper () {objapp=Newapplication (); } Public voidOpen (stringfileName) { ObjectObjdoc =FileName; ObjectObjmissing =Missing.Value; Doc= ObjApp.Documents.Open (refobjdoc); Doc. Activate (); } Publicparagraphs getparagraphs () {returnobjApp.ActiveDocument.Paragraphs; } Public stringGetparagraphs (intindex) {returnObjapp.activedocument.paragraphs[index]. Range.Text; } Public voidClose () {objApp.ActiveDocument.Close (); Objapp.quit (); }}
Aspose.word reading Word paragraph content