DEV Community

Oscar Sun(孫守真字任真)
Oscar Sun(孫守真字任真)

Posted on

Answer: How can I count rows of a Table in a Word document with C#

This is the Visual Studio 2022 .NET Core demo.

If you have MS Word installed, first refer to the COM reference:

enter image description here enter image description here

using StackOverflowCSConsoleApp1
using winword=Microsoft.Office.Interop.Word;

MyClass.How_can_I_count_rows_of_a_Table_in_a_Word_document_with_CSharpHow_can_I_count_rows_of_a_Table_in_a_Word_document_with_CSharp();

namespace StackOverflowCSConsoleApp1 {

    public static class MyClass
    {
        
        public static void How_can_I_count_rows_of_a_Table_in_a_Word_document_with_CSharpHow_can_I_count_rows_of_a_Table_in_a_Word_document_with_CSharp()
        {
            //winword.Application app = new Microsoft.Office.Interop.Word.Application();
            winword.Application app = new winword.Application();
            const

Top comments (0)