前提doc.Content.Tables.Count >0
错误:doc.Content.Tables[0].Rows.Add(ref beforeRow);
正确:doc.Content.Tables[1].Rows.Add(ref beforeRow);
如上一句在运行时会报 集合所要求的成员不存在的错误
问题出在 要以1开始索引,一般我们都用0开始的索引遍历集合的。但是在VBA等程序里确实以1开始的。
前提doc.Content.Tables.Count >0
错误:doc.Content.Tables[0].Rows.Add(ref beforeRow);
正确:doc.Content.Tables[1].Rows.Add(ref beforeRow);
如上一句在运行时会报 集合所要求的成员不存在的错误
问题出在 要以1开始索引,一般我们都用0开始的索引遍历集合的。但是在VBA等程序里确实以1开始的。
相关文章: