Skip to content

Instantly share code, notes, and snippets.

View openize-words-gists's full-sized avatar

Openize Words Gists openize-words-gists

View GitHub Profile
@openize-words-gists
openize-words-gists / Modify-Multiple-Frame-Paragraphs.cs
Created June 12, 2024 12:23
C# Modify 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);
foreach (var paragraph in body.Paragraphs)
{
if (paragraph.ParagraphBorder.Size > 0)
{
@openize-words-gists
openize-words-gists / Read-Multiple-Frame-Paragraphs.cs
Created June 12, 2024 12:20
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}");
@openize-words-gists
openize-words-gists / Create-Multiple-Frame-Paragraphs.cs
Created June 12, 2024 12:18
C# Create Multiple Frame Paragraphs in Word Documents
// Prerequisite: Install <a href="https://www.nuget.org/packages/Openize.Words">Openize.Words</a>.
// Initialize a new word document with the default template
var doc = new Openize.Words.Document();
System.Console.WriteLine("Word Document with default template initialized");
// Initialize the body with the new document
var body = new Openize.Words.Body(doc);
System.Console.WriteLine("Body of the Word Document initialized");
@openize-words-gists
openize-words-gists / Modify-Multiple-Multilevel-List-Paragraphs.cs
Created May 22, 2024 14:05
C# Modify Multiple Multilevel List 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($"MultilevelLists.docx");
// Initialize the body with the document
var body = new Openize.Words.Body(doc);
foreach (var paragraph in body.Paragraphs)
{
@openize-words-gists
openize-words-gists / Read-Multiple-Multilevel-List-Paragraphs.cs
Created May 22, 2024 14:03
C# Read Multiple Multilevel List 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($"MultilevelLists.docx");
// Initialize the body with the document
var body = new Openize.Words.Body(doc);
var paragraphs = body.Paragraphs;
@openize-words-gists
openize-words-gists / Create-Multiple-Multilevel-List-Paragraphs.cs
Created May 22, 2024 14:01
C# Create Multiple Multilevel List Paragraphs in Word Documents
// Prerequisite: Install <a href="https://www.nuget.org/packages/Openize.Words">Openize.Words</a>.
// The resulting docx document should be like this: https://i.imgur.com/6PKIb56.png
// Initialize docx document
var doc = new Openize.Words.Document();
System.Console.WriteLine("Word Document with default template initialized");
// Initialize document body
var body = new Openize.Words.Body(doc);
@openize-words-gists
openize-words-gists / Modify-Roman-Alphabetic-Paragraphs.cs
Created May 22, 2024 13:59
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)
{
@openize-words-gists
openize-words-gists / Read-Roman-Alphabetic-Paragraphs.cs
Created May 22, 2024 13:57
C# Read 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);
var paragraphs = body.Paragraphs;
@openize-words-gists
openize-words-gists / Create-Roman-Alphabetic-Paragraphs.cs
Created May 22, 2024 13:55
C# Create Roman Alphabetic Paragraphs in Word Documents
// Prerequisite: Install <a href="https://www.nuget.org/packages/Openize.Words">Openize.Words</a>.
// Initialize docx document
var doc = new Openize.Words.Document();
System.Console.WriteLine("Word Document with default template initialized");
// Initialize document body
var body = new Openize.Words.Body(doc);
System.Console.WriteLine("Body of the Word Document initialized");
@openize-words-gists
openize-words-gists / Modify-Numbered-Word-Paragraphs.cs
Created May 22, 2024 13:37
C# Modify Numbered 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($"WordParagraphsNumbered.docx");
// Initialize the body with the document
var body = new Openize.Words.Body(doc);
//foreach (Openize.Words.IElements.Paragraph paragraph in body.Paragraphs)
foreach (var paragraph in body.Paragraphs)