Apply style to a specific word/sentence/letter

Hi,
I want to apply style for a specific letter/word/sentence. Please advise

I use following code for applying style…but it applies entire document.

bodyBuilder.ParagraphFormat.Style.Name = "Heading 1";

Hi there,

Thanks for your inquiry. Please check following code snippet to set different styles to different text. Hopefully it will help you to accomplish the task. However, if there is any difference in your requirement then please share some more details, so we will guide you accordingly.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// add text with Heading1 style.
var para = builder.InsertParagraph();
para.AppendChild(new Run(doc) { Text = "Heading 1 Text" });
para.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
// add text with Normal style.
para = builder.InsertParagraph();
para.AppendChild(new Run(doc) { Text = "Some content with Normal style under Heading 1 style." });
para.ParagraphFormat.StyleIdentifier = StyleIdentifier.Normal;
// add text with Heading2 style.
para = builder.InsertParagraph();
para.AppendChild(new Run(doc) { Text = "Heading 2 Text" });
para.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;
// add text with NormalWeb style.
para = builder.InsertParagraph();
para.AppendChild(new Run(doc) { Text = "Some other content with NormalWeb style under Heading 2 style." });
para.ParagraphFormat.StyleIdentifier = StyleIdentifier.NormalWeb;
doc.Save("E:/Data/Style_out.DOCX");

Best Regards,