Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

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: 2328
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: 2328
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc