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.
Unfortunately, activation email could not send to your email. Please try again.

Using the same Fonts

Thread ID:

Created:

Updated:

Platform:

Replies:

126416 Oct 14,2016 08:20 AM Oct 25,2016 02:08 AM ASP.NET MVC 7
loading
Tags: DocIO
New Tester
Asked On October 14, 2016 08:20 AM

table[value_y - 2, value_x - 1].AddParagraph().AppendText("bla");
table[value_y - 2, value_x ].AddParagraph().AppendText("bla");

table[value_y - 1, value_x - 1].AddParagraph().AppendText("bla");
table[value_y - 1, value_x ].AddParagraph().AppendText("bla");

table[value_y, value_x - 1].AddParagraph().AppendText("bla");
table[value_y, value_x ].AddParagraph().AppendText("bla");

For this snippet

Sethumanikkam Yogendran [Syncfusion]
Replied On October 17, 2016 02:03 AM

Hi Customer,

Thank you for contacting Syncfusion support.

Please find the below code snippets for your requirement, in this code snippet we were tried to create custom style with font formatting and applied it to the paragraph of table.

//Adds a new paragraph style named "MyStyle" 
IWParagraphStyle myStyle = wordDocument.AddParagraphStyle("MyStyle"); 
//Sets the formattings of the style 
myStyle.CharacterFormat.FontName = "Arial"; 
myStyle.CharacterFormat.FontSize = 17f; 
 
IWParagraph iWParagraph = wTable[value_y - 2, value_x - 1].AddParagraph(); 
//Applies the style to paragraph 
iWParagraph.ApplyStyle("MyStyle"); 
//Appends the contents into the paragraph 
iWParagraph.AppendText("bla");

Note: Apply this custom style to all paragraphs to get same fonts in the resultant document.

Please refer the following link to know more about how to work with tables and apply formatting using styles.
https://help.syncfusion.com/file-formats/docio/working-with-paragraph#applying-paragraph-formatting
https://help.syncfusion.com/file-formats/docio/working-with-word-document#working-with-styles

If we misunderstood your requirement, kindly update us requirement with clear description. Thereby we will analyze further on the mentioned requirement and update you with appropriate solution.

Please let us know if you have any further questions.

Thanks,
Sethumanikkam.Y


mvxyc
Replied On October 18, 2016 01:58 AM

Thanks, but how to change the entire content of a cell plus format it with custom styling instead of adding a paragraph ?

Sethumanikkam Yogendran [Syncfusion]
Replied On October 19, 2016 01:49 AM

Hi Customer,

Thank you for your update.

On further analysing with the given details we suspect anyone of the following is your requirement.

1. Load input Word document which contains table.
2. Create a new custom paragraph style with its formatting (for example: Font formatting).
3. Apply created paragraph style to all paragraphs which exist in particular table cell.

Kindly provide your confirmation on the mentioned cases, thereby we will analyse further and will provided you appropriate solution.

For more details kindly refer following UG Link:
https://help.syncfusion.com/file-formats/docio/working-with-tables
https://help.syncfusion.com/file-formats/docio/working-with-paragraph#applying-paragraph-formatting

If we misunderstand your requirement then, kindly provide us Input document used (if any) and screenshot/output Word document of the expected result which will helpful to provide you the appropriate solution


Thanks,
Sethumanikkam.Y


Testname
Replied On October 19, 2016 05:25 AM

Based on this example:
//Adds a new paragraph style named "MyStyle" 
IWParagraphStyle myStyle = wordDocument.AddParagraphStyle("MyStyle"); 
//Sets the formattings of the style 
myStyle.CharacterFormat.FontName = "Arial"; 
myStyle.CharacterFormat.FontSize = 17f; 
 
IWParagraph iWParagraph = wTable[value_y - 2, value_x - 1].AddParagraph(); 
//Applies the style to paragraph 
iWParagraph.ApplyStyle("MyStyle"); 
//Appends the contents into the paragraph 
iWParagraph.AppendText("bla");


Instead of adding a paragraph I want to overwrite the entire content of the cell.

How to do this ?



Sethumanikkam Yogendran [Syncfusion]
Replied On October 19, 2016 09:08 AM

Hi Customer,

Thank you for your update.

We have prepared a sample to meet your requirement. In this sample, we have created “ApplyFormattingForCellContent” extension method and passing ‘WTableCell’ as argument to apply formatting for all its contents.

Please find the below sample which illustrates the same, and let us know if it helps you.
http://www.syncfusion.com/downloads/support/forum/126416/ze/Forum-126416-245560135.zip

If we misunderstood your requirement, kindly update us requirement with clear description. Thereby we will analyze further on the mentioned requirement and update you with appropriate solution.

Please let us know if you have any other questions.

Thanks,
Sethumanikkam.Y


Testname
Replied On October 24, 2016 08:38 AM

Yes, it is much better, but I don't want to append a text I want to overwrite the cell. How ?

Sethumanikkam Yogendran [Syncfusion]
Replied On October 25, 2016 02:08 AM

Hi Customer,

Thank you for your update.

We have prepared a sample to meet your requirement. In this sample, we have done the following things as per your requirement.

1.  Loaded existing Word document which contains table using DocIO
2.  Accessed instance of Table from Section.
3.  Iterated Cell contents through Table elements.
4.  Overwritten Font formatting to all contents in Cell.
Note: Input Word document (bla.docx) exists in App_Data folder inside the DocIOApplication.

Please find the below which illustrates the same, and let us know if it helps you.
http://www.syncfusion.com/downloads/support/forum/126416/ze/Forum-126416-1345550519.zip

Please refer the following links to know more about how to work with tables, iterations of word document elements, and how to work with text.
https://help.syncfusion.com/file-formats/docio/working-with-tables
https://help.syncfusion.com/file-formats/docio/working-with-word-document#iterating-through-document-elements
https://help.syncfusion.com/file-formats/docio/working-with-paragraph#working-with-text

If we misunderstood your requirement, kindly update us requirement with clear description. Thereby we will analyze further on the mentioned requirement and update you with appropriate solution.

Please let us know if you have any other questions.

Thanks,
Sethumanikkam.Y
 


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.

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.

;