问题描述
当文件打开时,我将其上传到服务器,但是当文件打开时 Application_DocumentOpen 方法不起作用
解决方法
您需要创建一个 timer_tick 方法并每 30 秒从该方法上传一次。
像这样:
Timer Timer1 = new Timer();
void Application_DocumentOpen(Microsoft.Office.Interop.Word.Document Doc)
{
InitializeTimer();
}
void InitializeTimer()
{
Timer1.Interval = 30000;
Timer1.Tick += new EventHandler(Timer1_Tick);
}
private void Timer1_Tick (Object sender,EventArgs e)
{
DocumentEditingSendToServer(Doc.Application.ActiveDocument);
}