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.

Mon Aug 01, 2022 9:14 pm

Hi, how can I split a cell and access the resulting parts of the cell to change their contents? Can't find this in the documentation. Thank you in advance!

Diggital
 
Posts: 1
Joined: Mon Aug 01, 2022 7:03 pm

Tue Aug 02, 2022 3:02 am

Hi,

Thank you for your inquiry.
Please refer to the code below to achieve your requirement. If it does not help you, please provide your input document and desired result for further investigation.
Code: Select all
            Document doc = new Document();
            //Load the document
            doc.LoadFromFile("test.docx");
            //Get the first section
            Section section = doc.Sections[0];
            //Get the first table in the section
            Table table = section.Tables[0] as Table;
            //Split the cell
            table.Rows[2].Cells[3].SplitCell(2, 2);
            //Set text content
            table.Rows[2].Cells[3].Paragraphs[0].Text="change text";
            //Save the document
            doc.SaveToFile("output.docx");


Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Thu Oct 20, 2022 8:59 am

Hi,

Greetings from E-iceblue!
Did my code fix your issue? I would appreciate it much if you can give me some feedback at your convenience.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Return to Spire.Doc