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.

table[y, x].Paragraphs[0].Text

Thread ID:

Created:

Updated:

Platform:

Replies:

127090 Oct 25,2016 10:06 AM Oct 26,2016 05:45 AM ASP.NET MVC 3
loading
Tags: DocIO
Testname
Asked On October 25, 2016 10:06 AM

setting "table[y, x].Paragraphs[0].Text" to bold ?!

Sethumanikkam Yogendran [Syncfusion]
Replied On October 26, 2016 02:36 AM

Hi Customer,

Thank you for contacting Syncfusion support.

On further analyzing with given code snippet, we suspect you’re trying to set Bold formatting for complete text in particular paragraph. It is not possible to set Bold formatting directly for all text in paragraph. We achieved your requirement by iterate each text range and set Bold formatting to particular paragraph.

Please refer the following code snippets which illustrates the same.
for (int i = 0; i < (table[y, x].Paragraphs[0] as WParagraph).ChildEntities.Count; i++)
{
Entity entity = paragraph.ChildEntities[i];
//A paragraph can have child elements such as text, image, hyperlink, symbols, etc.,
if( entity.EntityType == EntityType.TextRange)
//Set Bold to text.
(entity as WTextRange).CharacterFormat.Bold = true;
}


Please refer the following links to know more about how to work with table and text.
https://help.syncfusion.com/file-formats/docio/working-with-tables
https://help.syncfusion.com/file-formats/docio/working-with-paragraph#working-with-text

Please refer IterateParagraph from the following link to know more about how to iterate through document elements.
https://help.syncfusion.com/file-formats/docio/working-with-word-document#iterating-through-document-elements

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 26, 2016 05:17 AM

AT "paragraph.ChildEntities[i]" I get a 'System.ArgumentOutOfRangeException'. What to do ?

Sethumanikkam Yogendran [Syncfusion]
Replied On October 26, 2016 05:45 AM

Hi Customer,

Sorry for the inconvenience caused.

You should iterate the particular paragraph in which you want to set Bold formatting to the Text.

Please refer the following code snippets in which we have get the paragraph and iterated each text from entity collection and applied Bold formatting to that.
WParagraph paragraph = table[y, x].Paragraphs[0] as WParagraph;
for (int i = 0; i < paragraph.ChildEntities.Count; i++)
{
   
Entity entity = paragraph.ChildEntities[i];
   
//A paragraph can have child elements such as text, image, hyperlink, symbols, etc.,
    if (entity.EntityType == EntityType.TextRange)
       
//Set Bold to text.
        (entity as WTextRange).CharacterFormat.Bold = true;
}

Note: We have used given code snippet to get paragraph which is highlighted above.

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.

;