如何读取Word中的文本?
小弟最近在搞个小东东,想把Word中的文本读取到数据库并储存,无奈C#水平差得一塌糊涂,所以在读取文本的时候步骤特繁琐,代码如下:
string filepath = @ "C:\\\WEBNEW\Word\FORMAL\test.doc ";
string filepath2 = @ "C:\\temp\temp.txt ";
if (File.Exists(filepath))
{
Word.Application newApp = new Word.Application();
// 指定源文件和目标文件
object Source = filepath;
object Target = filepath2;
object Unknown = Type.Missing;
// 打开要转换的Word文件
newApp.Documents.Open(ref Source, ref Unknown,
ref Unknown, ref Unknown, ref Unknown,
ref Unknown, ref Unknown, ref Unknown,
ref Unknown, ref Unknown, ref Unknown,
ref Unknown, ref