我试试这段代码
string[] ext = att.Name.Split('.');
string file = ext[0].ToString();
object Target = file + ".txt";
object nullobject = System.Reflection.Missing.Value;
Application.Documents.Open(ref FileName, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref value, ref value, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatUnicodeText;
Application.ActiveDocument.SaveAs(ref Target, ref format,
ref Unknown, ref Unknown, ref Unknown,
ref Unknown, ref Unknown, ref Unknown,
ref Unknown, ref Unknown, ref Unknown,
ref Unknown, ref Unknown, ref Unknown,
ref Unknown, ref Unknown);
Application.Visible = false;
Microsoft.Office.Interop.Word.Document oDoc1 = Application.ActiveDocument;
string strNewDocText1 = oDoc1.Content.Text;
但在 strNewDocText1 中获取输出,包括项目符号和额外的单词格式
我想将我的 word 文档的简单纯文本格式转换为文本文档。