获得当前文档的文件名
2015-11-12 12:20:44 访问(1601) 赞(0) 踩(0)
/// <summary>
/// 获得当前文档的文件名
/// </summary>
/// <param name="_applicationObject"></param>
/// <returns></returns>
public string GetDocumentFullName(DTE2 _applicationObject)
{
if (_applicationObject == null)
{
throw new Exception
(
"方法:"
+ MethodBase.GetCurrentMethod().ReflectedType.FullName
+ " "
+ MethodBase.GetCurrentMethod().ToString()
+ " 发生异常:"
+ "DTE2 _applicationObject"
+ "值为null。"
);
}
Document doc = _applicationObject.ActiveDocument;
if (doc == null)
{
throw new Exception
(
"方法:"
+ MethodBase.GetCurrentMethod().ReflectedType.FullName
+ " "
+ MethodBase.GetCurrentMethod().ToString()
+ " 发生异常:"
+ "Document doc = _applicationObject.ActiveDocument"
+ "值为null。"
);
}
return doc.FullName;
}
标签:
获得当前文档的文件名 


上一条:
下一条:
相关评论
发表评论