日期:2014-05-17 浏览次数:21097 次
Word._Document oDoc;//文档对象
object path = @"E:\XXX.docx";//地址
oDoc = oWord.Documents.Open(ref path, ref oMissing, ref oReadOnly, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
Word.Table tab = oDoc.Tables[1];//获取表
String format = oDoc.Paragraphs.Format.ToString();//段落格式
/// <summary>
/// 获取word批注信息
/// </summary>
/// <param name="filePath">文档路径</param>
/// <returns>批注信息</returns>
public string GetWordNotes(string filePath)
{
object Nothing = System.Reflection.Missing.Value;
string strWordComments = string.Empty;
Microsoft.Office.Interop.Word.Application wordApp = new Application();
wordApp.Visible = false;
Document wordDoc = new Document();
wordDoc = wordApp.Documents.Open(filePath, Nothing, Nothing, Nothing, Nothing,
Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing);
try
{
foreach (Comment wordComment in wordDoc.Comments)
{
strWordComments += wordComment.Range.Text+" 作者:"+wordComment.Author+" 创建日期:"+wordComment.Date;
}
}
catch