Created
June 12, 2024 12:20
-
-
Save openize-words-gists/a577267cc39bae46ace887d0860422db to your computer and use it in GitHub Desktop.
C# Read Multiple Frame Paragraphs in Word Documents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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