using Newtonsoft.Json.Linq; using NPOI.XWPF.UserModel; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; namespace YLErp.Office.Helpers { public class DocHelper { public static string GetContent(string docFilePath) { string text = ""; using (FileStream fs = new FileStream(docFilePath, FileMode.Open, FileAccess.Read)) { XWPFDocument doc = new XWPFDocument(fs); foreach (var para in doc.Paragraphs) { string v = para.ParagraphText; //获得文本 text += "

" + v + "

"; } } return text; } } }