是否可以使用 Microsoft.Office.Interop.Word 以编程方式从 Word 文档中删除行号?

Is it possible to use Microsoft.Office.Interop.Word to programatically remove line numbering from a Word document?

我想使用 Microsoft.Office.Interop.Word 以编程方式 remove all line numberings 来自 Word 文档。 (这怎么可能?

我应该使用 LineNumbering interface 吗?

行号是文档或 section-level 设置,它由 PageSetup 对象控制。要在整个文档中简单地关闭它:

Word.Document doc = wdApp.ActiveDocument;
doc.PageSetup.LineNumbering.Active = false;