Skip to content

Instantly share code, notes, and snippets.

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

fileformat-words-gists

View GitHub Profile
@fileformat-words-gists
fileformat-words-gists / Modify-Roman-Alphabetic-Paragraphs.cs
Last active April 26, 2024 06:55
C# Modify Roman Alphabetic Paragraphs in Word Documents
// Prerequisite: Install <a href="https://www.nuget.org/packages/FileFormat.Words">FileFormat.Words</a>.
// Load the Word Document
var doc = new FileFormat.Words.Document($"filename.docx");
// Initialize the body with the document
var body = new FileFormat.Words.Body(doc);
foreach (var paragraph in body.Paragraphs)
{
@fileformat-words-gists
fileformat-words-gists / Read-Roman-Alphabetic-Paragraphs.cs
Last active April 26, 2024 06:57
C# Read Roman Alphabetic Paragraphs in Word Documents
// Prerequisite: Install <a href="https://www.nuget.org/packages/FileFormat.Words">FileFormat.Words</a>.
// Load the Word Document
var doc = new FileFormat.Words.Document($"filename.docx");
// Initialize the body with the document
var body = new FileFormat.Words.Body(doc);
var paragraphs = body.Paragraphs;
@fileformat-words-gists
fileformat-words-gists / Create-Roman-Alphabetic-Paragraphs.cs
Created April 23, 2024 13:30
C# Create Roman Alphabetic Paragraphs in Word Documents
// Prerequisite: Install <a href="https://www.nuget.org/packages/FileFormat.Words">FileFormat.Words</a>.
// Initialize word document
FileFormat.Words.Document doc = new FileFormat.Words.Document();
System.Console.WriteLine("Word Document with default template initialized");
// Initialize document body
var body = new FileFormat.Words.Body(doc);
System.Console.WriteLine("Body of the Word Document initialized");
@fileformat-words-gists
fileformat-words-gists / Modify-Numbered-Word-Paragraphs.cs
Created April 23, 2024 10:41
C# Modify Numbered Paragraphs in Word Documents
// Prerequisite: Install <a href="https://www.nuget.org/packages/FileFormat.Words">FileFormat.Words</a>.
// Load the Word Document
var doc = new FileFormat.Words.Document($"filename.docx");
// Initialize the body with the document
var body = new FileFormat.Words.Body(doc);
foreach (var paragraph in body.Paragraphs)
{
@fileformat-words-gists
fileformat-words-gists / Read-Numbered-Word-Paragraphs.cs
Last active April 23, 2024 13:31
C# Read Numbered Paragraphs in Word Document
// Prerequisite: Install <a href="https://www.nuget.org/packages/FileFormat.Words">FileFormat.Words</a>.
// Load the Word Document
var doc = new FileFormat.Words.Document($"{documentDirectory}/{filename}");
// Initialize the body with the document
var body = new FileFormat.Words.Body(doc);
var paragraphs = body.Paragraphs;
@fileformat-words-gists
fileformat-words-gists / Create-Numbered-Word-Paragraphs.cs
Created April 23, 2024 10:27
C# Create Numbered Paragraphs in Word Document
// Prerequisite: Install <a href="https://www.nuget.org/packages/FileFormat.Words">FileFormat.Words</a>.
// Initialize word document
FileFormat.Words.Document doc = new FileFormat.Words.Document();
System.Console.WriteLine("Word Document with default template initialized");
// Initialize document body
var body = new FileFormat.Words.Body(doc);
System.Console.WriteLine("Body of the Word Document initialized");
@fileformat-words-gists
fileformat-words-gists / Modify-Word-Paragraph-Indent.cs
Created March 3, 2024 10:35
C# Modify Word Paragraph Indent
// Prerequisite: Install <a href="https://www.nuget.org/packages/FileFormat.Words">FileFormat.Words</a>.
// Load the Word Document
var doc = new FileFormat.Words.Document($"filename.docx");
// Initialize the body with the document
var body = new FileFormat.Words.Body(doc);
foreach (FileFormat.Words.IElements.Paragraph paragraph in body.Paragraphs)
{
@fileformat-words-gists
fileformat-words-gists / Read-Word-Paragraph-Indent.cs
Last active March 3, 2024 10:36
C# Read Word Paragraph Indent
// Prerequisite: Install <a href="https://www.nuget.org/packages/FileFormat.Words">FileFormat.Words</a>.
// Load the Word Document
var doc = new FileFormat.Words.Document($"filename.docx");
// Initialize the body with the document
var body = new FileFormat.Words.Body(doc);
System.Collections.Generic.List<FileFormat.Words.IElements.Paragraph>
paragraphs = body.Paragraphs;
@fileformat-words-gists
fileformat-words-gists / Create-Word-Paragraph-Indent.cs
Created March 3, 2024 10:17
C# Create Word Paragraph Indent
// Prerequisite: Install <a href="https://www.nuget.org/packages/FileFormat.Words">FileFormat.Words</a>.
// Initialize a new word document with the default template
var doc = new FileFormat.Words.Document();
System.Console.WriteLine("Word Document with default template initialized");
// Initialize the body with the new document
var body = new FileFormat.Words.Body(doc);
System.Console.WriteLine("Body of the Word Document initialized");
@fileformat-words-gists
fileformat-words-gists / Modify-Word-Paragraph-Alignment.cs
Last active April 22, 2024 07:34
C# Modify Word Paragraph Alignment
// Prerequisite: Install <a href="https://www.nuget.org/packages/FileFormat.Words">FileFormat.Words</a>.
// Load the Word Document
var doc = new FileFormat.Words.Document($"filename.docx");
// Initialize the body with the document
var body = new FileFormat.Words.Body(doc);
foreach (FileFormat.Words.IElements.Paragraph paragraph in body.Paragraphs)
{