Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

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

Select an option

Save openize-words-gists/a577267cc39bae46ace887d0860422db to your computer and use it in GitHub Desktop.
C# Read Multiple Frame 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($"WordParagraphsFrame.docx");
var body = new Openize.Words.Body(doc);
// Traverse and display paragraphs with plain text
foreach (var paragraph in body.Paragraphs)
{
System.Console.WriteLine($" Paragraph Text: {paragraph.Text}");
if (paragraph.ParagraphBorder.Size > 0)
{
System.Console.WriteLine($" Paragraph Border Width: {paragraph.ParagraphBorder.Width}");
System.Console.WriteLine($" Paragraph Border Color: {paragraph.ParagraphBorder.Color}");
System.Console.WriteLine($" Paragraph Border Size: {paragraph.ParagraphBorder.Size}");
}
else
{
System.Console.WriteLine($" Paragraph Border Width: ");
System.Console.WriteLine($" Paragraph Border Color: ");
System.Console.WriteLine($" Paragraph Border Size: ");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment