最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - Check whether two Word tables are under the same heading - Stack Overflow

programmeradmin0浏览0评论

I am using Microsoft Office Interop Word in C# to edit word files. Is there a way to check the tables are under same heading?

My End goal is to delete an empty table from Word Document. That is - if two tables are present under same heading or between two given heading and one the table is empty then I want to delete the empty table.

Using below code I am able to loop through and delete the tables but don't know how to see they are under same heading.

Microsoft.Office.Interop.Word.Document doc = app.Documents
    .Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss,
          ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss,
          ref miss, ref miss, ref miss);
foreach (Microsoft.Office.Interop.Word.Table tbl in doc.Tables)
{
    tbl.Delete();
}
发布评论

评论列表(0)

  1. 暂无评论