We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to take the full width of a word page using a word-table, it should not matter wether it is landscape or portrait ?!

Thread ID:





124999 Jul 13,2016 11:25 AM UTC Jul 19,2016 11:19 AM UTC ASP.NET MVC 6
Tags: DocIO
New Tester
Asked On July 13, 2016 11:25 AM UTC

How to take the full width of a word page using a word-table, it should not matter wether it is landscape or portrait ?!

Priyanga Elangovan [Syncfusion]
Replied On July 14, 2016 07:20 AM UTC

Hi Customer,

Thank you for contacting Syncfusion support.

Yes, you can retrieve the full width of
a page for each section using PageSize property of WPageSetup class in DocIO.  
Kindly refer the below code snippet to retrieve the page width using a Word Table. 
//creates the document 
WordDocument document = new WordDocument(); 
//Adds the table to the document 
WTable table = document.LastSection.AddTable() as WTable; 
table.ResetCells(4, 4); 
//Gets the owner section of table using GetOwnerSection method 
WSection section = GetOwnerSection(table); 
//Retrieve the page width by using pagesize property 
float pagewidth = section.PageSetup.PageSize.Width; 
//Gets the owner section of the table: 
Private WSection GetOwnerSection(WTable table) 
//Gets the owner of the table 
Entity entity = table.Owner; 
while (!(entity is WSection)) 
if (entity.Owner != null) 
entity = entity.Owner; 
return entity as WSection 

If we misunderstood your requirement, kindly elaborate your requirement with clear description (like screenshot of your output or expected output document), Thereby we will analyze further on your requirement and update you appropriate solution at the earliest.

Please let us know if you have any other queries.


New Tester
Replied On July 15, 2016 06:36 AM UTC

Thank you, for your answer, but I want the word table to have the same size as the page with, so that that the table will use the entire width(horizontal and vertically pages) and it should look good(the proportions of the cells).

Ayswarya Krishna Kumar [Syncfusion]
Replied On July 18, 2016 11:00 AM UTC

Hi Customer,

Thank you for your update.

Yes, it is possible to have the Word table as of same size of its page width. Kindly use the below code snippet to achieve your requirement.

//Retrieve the page client area width by using page setup property  
float pageClientWidth = section.PageSetup.ClientWidth; 
//Iterating through each cells and setting up width 
//in order to fit the table 
foreach (WTableRow row in table.Rows) 
foreach (WTableCell cell in row.Cells) 
//Updates the cell width based on the page client area width 
cell.Width = pageClientWidth / row.Cells.Count; 
Note: Page client width excludes page margins (left and right) where as page width includes the complete width.


New Tester
Replied On July 18, 2016 11:31 AM UTC

My table has the following declaration "IWTable table = section.AddTable();" , can you adjust your example for this `??

New Tester
Replied On July 18, 2016 11:32 AM UTC

"table[y, x]" maybe over indexers ?!

Priyanga Elangovan [Syncfusion]
Replied On July 19, 2016 11:19 AM UTC

Hi Customer

Thank you for your update

We have prepared the sample to meet your requirement. Please find the sample from below link. Try running the sample and let us know whether it helps you.
Sample link:



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon