日期:2014-05-18 浏览次数:20493 次
protected void Button1_Click(object sender, EventArgs e) { object oReadOnly = true; object oMissing = System.Reflection.Missing.Value; object oFileName ="E:/文档.docx"; Word._Application oWord; Word._Document oDoc; oWord = new Word.Application(); //oWord.Visible = true; oDoc = oWord.Documents.Open(ref oFileName, ref oMissing, ref oReadOnly, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing); returnContent = oDoc.Content.Text; oDoc.Close(ref oMissing, ref oMissing, ref oMissing); WorkLog wl = new WorkLog(); wl.Acnt_id = "111"; wl.Del_flg = false; wl.Dma_code = ""; wl.Log_body = returnContent; wl.Log_time = DateTime.Now; wl.Mdf_time = DateTime.Now; AccountService As = new AccountService(); Account acc = As.Login("test", "test"); As.AddWorkLog(wl); //关闭COM oWord.Quit(ref oMissing, ref oMissing, ref oMissing); //File.Delete(oFileName.ToString()); } }