Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save openize-words-gists/0686c2de379c81c945c44f8192029621 to your computer and use it in GitHub Desktop.

Select an option

Save openize-words-gists/0686c2de379c81c945c44f8192029621 to your computer and use it in GitHub Desktop.
C# Modify Roman Alphabetic Paragraphs in Word Documents
// Prerequisite: Install <a href="https://www.nuget.org/packages/Openize.Words">Openize.Words</a>.
// Load the Word Document
var doc = new Openize.Words.Document($"WordParagraphsRomanAlphabetic.docx");
// Initialize the body with the document
var body = new Openize.Words.Body(doc);
foreach (var paragraph in body.Paragraphs)
{
if (paragraph.Style == "ListParagraph")
{
paragraph.Style = "Normal";
paragraph.AddRun(new Openize.Words.IElements.Run
{ Text = " (alphabet removed)", Italic = true });
doc.Update(paragraph);
}
}
// Save the modified Word Document
doc.Save($"ModifiedDocumnet.docx");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment