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

DocIO Table Full Width of Page

Thread ID:





119329 Jun 5,2015 03:22 PM UTC Jun 9,2015 12:40 PM UTC Xamarin.Forms 4
Tags: DocIO
Jordan Spence
Asked On June 5, 2015 03:22 PM UTC

I'm trying to create a table that spans the full width of the page.  When I use ResetCells(1,2, null, section.PageSetup.ClientWidth / 2) or set the cell width manually, the cells only expand as far as the text inside the cells.  How can I get the table to expand the full width of the page regardless of what is in the cell?

Sarathkumar V [Syncfusion]
Replied On June 8, 2015 01:30 PM UTC

Hi Jordan,

 Thank you for using Syncfusion products.

 We are unable to reproduce the mentioned table cell width issue while resets the rows/columns using "ResetCells(int rowsNum, int columnsNum, RowFormat format, float cellWidth)" method of WTable class. Each cells in the created table preserves the same width defined in the last parameter of the above mentioned method. Could you please provide us the code snippet/sample used at your side to reproduce the issue? Also provide us the mobile platform details and word viewer details which you have used in your mobile phone to view the DocIO generated word document.

 Please let us know if you have any other questions.



Jordan Spence
Replied On June 8, 2015 01:51 PM UTC

This code generates a table that isn't the full width of page, and only as big as the text inside it.

WordDocument document = new WordDocument();
var newSection = document.AddSection();
// Add a new table to the header.
IWTable table = section.HeadersFooters.Header.AddTable();
// Inserting table with a row and two columns.
table.ResetCells(1, 3, null, newSection.PageSetup.ClientWidth / 3);

// Column 1
var firstParagraph = table[0, 0].AddParagraph() as WParagraph;
IWTextRange txt = firstParagraph.AppendText("LOGO");
txt.CharacterFormat.Font.FontFamilyName = "Arial";
txt.CharacterFormat.FontSize = 10;

// Column 2
var secondParagraph = table[0, 1].AddParagraph() as WParagraph;
table[0, 1].CellFormat.VerticalAlignment = VerticalAlignment.Top;
secondParagraph.ParagraphFormat.AfterSpacing = 0f;
txt = secondParagraph.AppendText("Name" + Environment.NewLine + "Date" + Environment.NewLine + "User Name");
secondParagraph.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Left;

// Column 3
var thirdParagraph = table[0, 2].AddParagraph() as WParagraph;
table[0, 2].CellFormat.VerticalAlignment = VerticalAlignment.Top;
thirdParagraph.ParagraphFormat.AfterSpacing = 0f;
var column3Text = string.Format("{0}: {1}" + Environment.NewLine + "{2}: {3}" + Environment.NewLine + "{4}: {5}" + Environment.NewLine + "{6}: {7}" + Environment.NewLine + "{8}: {9}" + Environment.NewLine, "Date", "2", "Mgr", "4", "Company", "6", "Country", "8", "Type", "10");

txt = thirdParagraph.AppendText(column3Text);
txt.CharacterFormat.FontSize = 9f;
thirdParagraph.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Left;

Jordan Spence
Replied On June 8, 2015 02:15 PM UTC

I'm running this through Xamarin Studio on a Mac using the IPhoneSimulator.  Here is a screenshot from the simulator.  As you can see all the text is pushed together because the table doesnt take up the full width of the page.

Attachment: mac_223717b4.zip

Sarathkumar V [Syncfusion]
Replied On June 9, 2015 12:40 PM UTC

Hi Jordan,


Thank you for your update.


On further analyzing, the reported table cell width issue due to the word viewer application which you have used in your iPhoneSimulator. We have checked the same document with Microsoft Mobile Office application, in that table cell width are preserved properly as defined in ResetCells(int rowsNum, int columnsNum, RowFormat format, float cellWidth) method of WTable class. For your reference we have attached the screen shot below. The same issue will occur when you open the MS word generated document in that word viewer application, so it is not an issue in our side. Kindly make use of MS Mobile office or any other word viewer application to resolve the issue.


Attachment: http://www.syncfusion.com/downloads/support/directtrac/138591/ze/TableCellWidth-442983520


Please let us know if you have any other questions.





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

This page will automatically be redirected to the 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