Different ParagraphFormat.Style in same cell

Hi experts,
Is it possible to achieve the different ParagraphFormat.Style in same table cell?
For example:
Hello word! Hello word!
The blue coloured word is in different style.
Any example in achieve this?

Hi

Thanks for your request. You can achieve this using DocumentBuilder. You can find code examples here:
https://docs.aspose.com/words/net/working-with-fonts/
And here:
https://reference.aspose.com/words/net/aspose.words/documentbuilder/pushfont/
Hope this helps.
Best regards.

Hi Alexey,
Thanks for the reply. FYI, I gone through the links that you’ve provided in your reply and the help file. And yes, I can achieve the goal easily by using the method in the links. But, the purpose I want to do it in the way that mentioned in my first post is:

  1. Set styles in template doc.
  2. In code, I’ll only set the style name and write the content.

So that, in future, if there is any changes in the font type or colour, I’ll only need to change the template doc.
As if I using different ParagraphFormat.Style in 1 sentence for a several times, then the last style will actually overwrites the styles that applied before. I know this design does make sense, but just wondering is there any workaround.

Hi

Thanks for your request. Actually, there are few types of styles – Paragraph styles, Character styles, List styles and Table styles.
https://reference.aspose.com/words/net/aspose.words/styletype/
Character styles can be applied to a particular Run of text within paragraph. For example if you applied Paragraph style to the whole paragraph, you can also apply character style to the particular run. See the following code snippet for instance:

// Open document.
Document doc = new Document(@"Test001\in.doc");
// Create DocuemntBuilder object, which will help us to manipulate nodes.
DocumentBuilder builder = new DocumentBuilder(doc);
// Apply paragraph style to some paragraph.
// For example all Heading styles are Paragaph styles.
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
// Insert some text
builder.Write("This text inherits formating from Paragraph style ");
// Now we can apply Character style
builder.Font.StyleName = "myCharacterStyle";
builder.Write("This is text with some other formating ");
// Here we can clear formating
builder.Font.ClearFormatting();
builder.Write("This text inherits fonrmating form paragraph style");
// Save output document.
doc.Save(@"Test001\out.doc");

Hope this helps.
Best regards.