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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

FitText in WordDocument do not refresh

Thread ID:

Created:

Updated:

Platform:

Replies:

145803 Jul 9,2019 08:16 AM UTC Jul 9,2019 02:57 PM UTC WPF 2
loading
Tags: DocIO
Christian Stutz
Asked On July 9, 2019 08:16 AM UTC

Hello,
i add a Table to new word document. then i modify the cell with "TextWarp" and "FitText" but afte opend the word document the text in cells arent fitted.
When i focus the row the text fits.
Is there any problem?
My code:
foreach (XmlTemplate.TableRow tableRow in xmlTemplate.TableRows)
{
if (tableRow.Type.CompareTo("Header") == 0)
{

Debug.WriteLine("Add ROW");
WTableRow row = wTable.AddRow();
row.Height = GetCmToFloat(Convert.ToDecimal(0.875));
row.IsHeader = true;
row.HeightType = TableRowHeightType.Exactly;
foreach (XmlTemplate.Cell cell in tableRow.CellsList)
{
WTableCell wTableCell = row.AddCell();
wTableCell.Width = GetCmToFloat(cell.Width);

IWTextRange wTextRange = wTableCell.AddParagraph().AppendText(cell.Text);

wTextRange.CharacterFormat.FontName = string.IsNullOrEmpty(cell.Font) ? "Arial" : cell.Font;
wTextRange.CharacterFormat.FontSize = cell.FontSize;
wTextRange.CharacterFormat.Bold = true;
if (!string.IsNullOrWhiteSpace(cell.Halignment))
{
wTextRange.OwnerParagraph.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Center;
}
}
}
}
....
IWSection wSection = wordDocument.Sections[0];
IWTable wTable = wSection.Tables[0];
for (int i = 0; i <= wTable.Rows.Count - 1; i++)
{
WTableRow row = wTable.Rows[i];
List cellList = xmlTemplate.TableRows[i].CellsList;
for (int j = 0; j <= row.Cells.Count - 1; j++)
{
XmlTemplate.Cell cell = cellList[j];
WTableCell wTableCell = row.Cells[j];
wTableCell.CellFormat.SamePaddingsAsTable = false;
wTableCell.Width = GetCmToFloat(cell.Width);
if (cell.CellMargin != null)
{

wTableCell.CellFormat.Paddings.Left = GetCmToFloat(cell.CellMargin.Left);
wTableCell.CellFormat.Paddings.Right = GetCmToFloat(cell.CellMargin.Right);

}
else
{

wTableCell.CellFormat.Paddings.Left = GetCmToFloat(Convert.ToDecimal(0.1));

}
wTableCell.CellFormat.TextWrap = cell.IsTextWarp;
wTableCell.CellFormat.FitText = cell.IsTextWarp;

wTableCell.CellFormat.Borders.BorderType = BorderStyle.Single;
wTableCell.CellFormat.Borders.LineWidth = 1;
wTableCell.CellFormat.VerticalAlignment = VerticalAlignment.Middle;
wTableCell.CellFormat.HorizontalMerge = CellMerge.Start;
wTableCell.CellFormat.BackColor = Color.LightGray;

}
}
Christian

Mohanaselvam  Jothi [Syncfusion]
Replied On July 9, 2019 02:18 PM UTC

Hi Christian,

Thank you for contacting Syncfusion support.

We can reproduce the reported text preservation problem in table in the Word document. We have faced conflicts (dependent code example missing) in the given code snippets. So, we have modified the code snippet to make runnable. Please find the sample which we tried at our end from the below link:
https://www.syncfusion.com/downloads/support/forum/145803/ze/CreateWordSample538545617

Please refer the below screenshot of generated Word document using above sample. 
After opened the generated Word document 
When focusing on not fitted text. 
 
 

On further checking with the reported problem, we have found after focusing on the particular text Microsoft Word viewer preserves the text properly in visual appearance and not found any changes in the file level for this preservation changes. This is not an issue in DocIO and it is problem when rendering contents by Word viewer.

Please let us know if you have any other questions.

Regards,
Mohanaselvam J


Poorani Rajendran [Syncfusion]
Replied On July 9, 2019 02:57 PM UTC

Hi Christian,

Please ignore our previous update.

We can reproduce the reported text preservation problem in table in the Word document. We have faced conflicts (dependent code example missing) in the given code snippets. So, we have modified the code snippet to make runnable. Please find the sample which we tried at our end from the below link:
https://www.syncfusion.com/downloads/support/forum/145803/ze/CreateWordSample538545617

Please refer the below screenshot of generated Word document using above sample. 
After opened the generated Word document 
When focusing on not fitted text. 
 
 

On further checking with the reported problem, we have found after focusing on the particular text Microsoft Word viewer preserves the text properly in visual appearance and not found any changes in the file level for this preservation changes. This is not an issue in DocIO and it is problem when rendering contents by Word viewer.

Please let us know if you have any other questions.

Regards,
Poorani Rajendran 




CONFIRMATION

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

Live Chat Icon For mobile
Live Chat Icon