怎么把.DOC转换成.TXT文件? [英] How to Convert .DOC to .TXT file?
本文介绍了怎么把.DOC转换成.TXT文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将.DOC(Word文档)转换为文本文件(.txt)
.DOC到.TXT
我如何在c#中转换它..
How do i convert .DOC (word document) to A text file (.txt)
.DOC to .TXT
how do i convert it in c# ..
??
推荐答案
Google"C#Office SDK".您应该能够找到指南.
Google "C# Office SDK". You should be able to find guidance.
尝试一下
try this
private string ReadDocFile(object sPath, ref string sDocContent)
{
Microsoft.Office.Interop.Word.ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
object missing = System.Reflection.Missing.Value;
Word._Document aDoc = null;
aDoc = wordApp.Documents.Open(ref sPath, ref missing, ref readOnly, ref missing, ref missing, ref missing,_
ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing,_
ref missing, ref missing, ref missing);
aDoc.Activate();
aDoc.ActiveWindow.Selection.WholeStory();
aDoc.ActiveWindow.Selection.Copy();
IDataObject data = Clipboard.GetDataObject();
sDocContent = data.GetData(DataFormats.UnicodeText).ToString();
wordApp.Documents.Close(ref isNoSave, ref missing, ref missing); ;
wordApp.Quit(ref isNoSave, ref missing, ref missing);
return (string)sDocContent;
}
谢谢,我会尽力而为:(
寻求帮助
Thanks, I''ll try & hope so :(
thx for help
这篇关于怎么把.DOC转换成.TXT文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文