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.

Fri Oct 28, 2022 11:31 am

I have installed FreeSpire.Doc Nuget package to create a Word Document in a .NET 4.8 Framework application. I want to insert a table in specific Bookmark of the document and I'm able to create and insert a table but not able to increase the right indent of the inserted table (Need to increase the width of the table to match the existing table alignment), due to this my alignment differs from the existing table.

I'm able to find the option for the left Indentation but not for right Indentation, is there any way to increase the right indentation as to match my expected width for my table alignment.
Code: Select all
table.TableFormat.LeftIndent = value;

venkat123
 
Posts: 1
Joined: Thu Oct 20, 2022 10:02 am

Mon Oct 31, 2022 9:48 am

Hello,

Thanks for your inquiry.
I simulated a document and tested it with the following code. I didn't reproduce your question. You can refer to my code below to test your file again. If your problem persists after the test, please provide us with your test documentation so that we can further investigate it. You can attache it here or send it to us via email ([email protected]). Thank you in advance.
Code: Select all
            Document doc = new Document();
            doc.LoadFromFile(@"E:\Test\Test\test22.docx");
            Section section = doc.Sections[0];
            Table table = section.Tables[0] as Table;
            Table table1 = section.AddTable(true);
            table1.ResetCells(3, 3);
            table1.PreferredWidth = table.PreferredWidth;
            table1.TableFormat.LeftIndent = table.IndentFromLeft;             
            doc.SaveToFile("sample.docx", FileFormat.Docx);


Sincerely,
Simple
E-iceblue support team
User avatar

Simple.Li
 
Posts: 248
Joined: Fri Jul 01, 2022 2:33 am

Return to Spire.Doc