标签:ocx string foreach project void stream cto ring str
Nuget安装
using NPOI.HWPF;
using NPOI.HWPF.Extractor;
static void NPOIReadWord() {
string path = @"D:\Project\NPOI_文本对比\PDF\1-太平粤港澳大湾区终身重大疾病保险条款.doc";
using (StreamReader streamReader = new StreamReader(path))
{
var document = new HWPFDocument(streamReader.BaseStream);
var wordExtractor = new WordExtractor(document);
var docText = new StringBuilder();
foreach (string text in wordExtractor.ParagraphText)
{
Console.WriteLine(text.Trim());
}
streamReader.Close();
}
}
标签:ocx string foreach project void stream cto ring str
原文地址:https://www.cnblogs.com/tangpeng97/p/14468489.html