2012年11月1日 星期四

[C#]WORD TO HTML




ApplicationClass word = new ApplicationClass();
Type wordType = word.GetType();
Documents docs = word.Documents;
           
Type docsType = docs.GetType();
object fileName = @"D:\tmp\123.doc";
Document doc = (Document)docsType.InvokeMember("Open", System.Reflection.BindingFlags.InvokeMethod, null, docs, new 
Object[] {fileName, true, true});
           
Type docType = doc.GetType();
object saveFileName = @"D:\tmp\123.HTML";
docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod, null, doc, new object[] { saveFileName, WdSaveFormat.wdFormatFilteredHTML });

 wordType.InvokeMember("Quit", System.Reflection.BindingFlags.InvokeMethod,null, word, null);





沒有留言:

張貼留言