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.

Thu Oct 11, 2012 1:08 pm

Hi,
i have a table with two columns and one row. Automatically takes the table 100% of the width of the document, giving the column1 and column2 the same width.
Why if I set a specific width to column1, column2 the remains as wide as before? I expected that the column2 take all the remaining width, to occupy 100% of the width of the document. How can I accomplish this? thanks

info@isis.it
 
Posts: 20
Joined: Thu Sep 27, 2012 9:01 am

Fri Oct 12, 2012 7:06 am

Hi,

Thanks for your inquiry.
Sorry that we don't support that after setting a specific width to column1, column2 will take the remaining width Automatically, but you can achieve the result through calculate, we provide a sample demo. If you have any problem, please feel free to contact us.
Code: Select all
            TableRow row=table.Rows [0];
           
            TableCell cell1 = row.Cells[0];
            float startWidth = cell1.Width;

            cell1.Width = 20;
            TableCell cell2 = table.Rows[0].Cells[1];
            cell2.Width = startWidth * 2 - 20;


Best regards,
Amy
e-iceblue support
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Wed Oct 17, 2012 10:07 am

thanks

info@isis.it
 
Posts: 20
Joined: Thu Sep 27, 2012 9:01 am

Thu Oct 18, 2012 2:40 am

Hi,

You are welcom! :D
If you have any problem, please feel free to contact us.

Best regards,
Amy
E-iceblue support
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc