Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Mar 07, 2017 1:36 pm

Hello,

I was wondering how you can add a string to a specific cell in an existing table in Word.
My programming language is C# and I'm using Visual Studio 2015.

Thanks in advance!

m.vanwinkelen@schoutenkampen.nl
 
Posts: 5
Joined: Tue Mar 07, 2017 9:57 am

Wed Mar 08, 2017 2:11 am

Hi,

Thanks for your inquiry.
Here is sample code for your reference.
Code: Select all
            Document document = new Document();
            document.LoadFromFile(@"F:\testing\sample.docx");
            Section sec = document.Sections[0];
            Table table = sec.Tables[0] as Table;
            //add string into the cell
            table.Rows[0].Cells[1].Paragraphs[0].AppendText("Hello");
            document.SaveToFile("9967.docx");

If there is any question, please let me know.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Mar 09, 2017 7:50 am

Hi,

Did you test the code ? Has your issue been fixed ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Mar 09, 2017 8:06 am

It's been fixed, thank you very much for your help!

m.vanwinkelen@schoutenkampen.nl
 
Posts: 5
Joined: Tue Mar 07, 2017 9:57 am

Thu Mar 09, 2017 8:18 am

Hi,

Thanks for your feedback.
Please feel free to contact us if there is any question, we are here for help :) .

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Doc