#endregion
//将WordDoc文档对象的内容保存为DOC文档
myWordDoc.SaveAs(ref strFileName,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing);
//关闭WordDoc文档对象
myWordDoc.Close(ref Nothing, ref Nothing, ref Nothing);
//关闭WordApp组件对象
myWordApp.Quit(ref Nothing, ref Nothing, ref Nothing);
}
///
/// 获取一个随即字符串
///
///
private string GetRandomString()
{
DateTime iNow=DateTime.Now;
string strDate=iNow.ToString("yyyyMMddHHmmffff");
Random ran=new Random();
int iRan=Convert.ToInt32(10000*ran.NextDouble());
string strRan=iRan.ToString();
//位数不足则补0
int iRanlen=strRan.Length;
for(int i=0;i<4-iRanlen;i++)
{
strRan="0"+strRan;
}
return strDate+strRan;
}
///
/// 将字符串写入到Word文件中
///
/// 要写入的字符串
private void WriteFile(string str)
{
myWordDoc.Paragraphs.Last.Range.Text=str;
}
}
}