Files
zszq-trs/Framework/YLErp.Core/Helpers/DocHelper.cs
T
2024-05-09 14:06:26 +08:00

32 lines
804 B
C#

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 += "<p>" + v + "</p>";
}
}
return text;
}
}
}