### Load PDF with Specific Pages
Source: https://context7
Loads selected pages from a PDF document for conversion or processing. Allows specifying the starting page index and the number of pages to load.
```csharp
using Wordize.Loading;
var pdfOptions = new PdfLoadOptions {
PageIndex = 5, // Start at page 6 (0-indexed)
PageCount = 10, // Load 10 pages
SkipPdfImages = false
};
Processor.From("large-document.pdf", pdfOptions)
.To("excerpt.docx")
.Execute();
// Expected: DOCX containing only pages 6-15 from original PDF
```
--------------------------------
### Set Document Load Format Explicitly - C#
Source: https://reference.wordize.com/net/wordize/loadformat
Demonstrates how to explicitly set the document load format in Wordize for .NET using LoadOptions. This example sets the format to Text and then converts a Markdown file to DOCX.
```csharp
LoadOptions loadOptions = new LoadOptions();
loadOptions.LoadFormat = LoadFormat.Text;
Converter.Create()
.From(MyDir + "Simple.md", loadOptions)
.To(ArtifactsDir + "LoadOptions.LoadFormat.docx")
.Execute();
```
--------------------------------
### Highlight C# Code Elements in HTML
Source: https://reference.wordize.com/net
This script targets `code.language-csharp` elements within the HTML document. It iterates through predefined lists of C# classes (like Converter, Merger) and methods (like Convert, Merge) to wrap them in span elements with specific CSS classes for highlighting. This enhances readability of C# code examples embedded in the documentation.
```javascript
document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll("code.language-csharp"),t=["Converter","Merger","Comparer","ReportBuilder","MailMerger","Replacer","Splitter","Signer","Watermarker","Wordize","Settings","DefaultFontSettings"];
const n=["Convert","ConvertToImages","Merge","MergeToImages","Compare","CompareToImages","BuildReport","BuildReportToImages","ExecuteWithRegions","Replace","ReplaceToImages","Split","ExtractPages","RemoveBlankPages","ExtractPages","Sign","RemoveAllSignatures","SetImage","SetText","SetWatermarkToImages","Create","From","To","Execute","OpenRead","Add","SetFontsFolder"];
e.forEach(e=>{let s=e.innerHTML;t.forEach(e=>{const t=new RegExp(`\\b${e}.`,"g");s=s.replace(t,`${e}.`)}),n.forEach(e=>{const t=new RegExp(`\\.${e}\\(`,"g");s=s.replace(t,`.${e}(`)}),e.innerHTML=s})})()
```
--------------------------------
### FontSourceBase API
Source: https://reference.wordize.com/net/wordize/loadformat
Base class for font sources, defining properties like Priority, Type, and methods for getting available fonts.
```APIDOC
## FontSourceBase API
### Description
Represents a base class for font sources, providing properties for priority and type, and a method to retrieve available fonts.
### Properties
- **Priority** (int) - The priority of this font source.
- **Type** (FontSourceType) - The type of this font source.
- **WarningCallback** (Action) - A callback function to invoke for warnings.
### Methods
- **GetAvailableFonts**: Retrieves a list of available fonts from this source.
### Endpoint
`/llmstxt/reference_wordize_llms_txt/net/wordize.fonts/fontsourcebase/`
```
--------------------------------
### Load HTML with Custom Settings
Source: https://context7
Configures HTML import behavior including block handling, SVG conversion, and resource timeout. Supports setting a base URI and preferred control type for structured content.
```csharp
using Wordize.Loading;
var htmlOptions = new HtmlLoadOptions {
BaseUri = "https://example.com/docs/",
ConvertSvgToEmf = true,
SupportVml = true,
SupportFontFaceRules = true,
WebRequestTimeout = 30000, // 30 seconds
BlockImportMode = BlockImportMode.Merge,
PreferredControlType = HtmlControlType.StructuredDocumentTag
};
Processor.From("document.html", htmlOptions)
.To("output.docx")
.Execute();
// Expected: DOCX with properly imported HTML content and styles
```
--------------------------------
### Configure Wordize License Key
Source: https://context7
Sets up the Wordize license key to enable full functionality and bypass evaluation limitations. Licenses can be set from a file path or a stream. This section also covers global font settings and text shaping configuration.
```csharp
using Wordize;
// Set license from file
Settings.SetLicense("Wordize.License.lic");
// Set license from stream
using var licenseStream = File.OpenRead("license.lic");
Settings.SetLicense(licenseStream);
// Configure global font settings
Settings.DefaultFontSettings.SetFontsFolder("C:/CustomFonts", recursive: true);
// Enable advanced text shaping for complex scripts
Settings.EnableTextShaping = true;
// Configure hyphenation
Settings.Hyphenation.RegisterDictionary("en-US",
File.OpenRead("hyph_en_US.dic"));
```
--------------------------------
### Initialize Matomo analytics tracking
Source: https://reference.wordize.com/net/wordize
This JavaScript code initializes Matomo (Piwik) analytics tracking. It sets the tracker URL and site ID, then asynchronously loads the Matomo tracking script.
```javascript
var _paq=window._paq=window._paq||[];_paq.push(["trackPageView"]),_paq.push(["enableLinkTracking"]),function(){e="https://a.wordize.com/",_paq.push(["setTrackerUrl",e+"m.php"]),_paq.push(["setSiteId","11"]);var e,n=document,t=n.createElement("script"),s=n.getElementsByTagName("script")[0];t.async=!0,t.src=e+"m.js",s.parentNode.insertBefore(t,s)}()
```
--------------------------------
### Implement Theme Switching for Web Pages
Source: https://reference.wordize.com/net
This JavaScript code manages theme switching functionality for a web page, allowing users to select between 'light', 'dark', or 'auto' themes. It stores the user's preference in localStorage and applies the theme by setting the `data-bs-theme` attribute on the `` element. It also listens for changes in the system's preferred color scheme to update the theme when set to 'auto'.
```javascript
(()=>{
"use strict";
const n="td-color-theme",s=()=>localStorage.getItem(n);
const i=e=>localStorage.setItem(n,e);
const e=()=>{
const e=s();
return e?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"
};
const t=e=>{
e==="auto"
?document.documentElement.setAttribute("data-bs-theme",window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")
:document.documentElement.setAttribute("data-bs-theme",e)
};
t(e());
const o=(e,t=!1)=>{
const s=document.querySelector("#bd-theme");
if(!s)return;
const o=document.querySelector("#bd-theme-text");
const i=document.querySelector(".theme-icon-active use");
const n=document.querySelector(`[data-bs-theme-value="${e}"]`);
const a=n.querySelector("svg use").getAttribute("href");
document.querySelectorAll("[data-bs-theme-value]").forEach(e=>{
e.classList.remove("active"),
e.setAttribute("aria-pressed","false")
});
n.classList.add("active"),
n.setAttribute("aria-pressed","true");
i.setAttribute("href",a);
if(o){
const e=`${o.textContent} (${n.dataset.bsThemeValue})`;
s.setAttribute("aria-label",e)
}
t&&s.focus()
};
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{
const n=s();
n!=="light"&&n!=="dark"&&t(e())
});
window.addEventListener("DOMContentLoaded",()=>{
o(e()),
document.querySelectorAll("[data-bs-theme-value]").forEach(e=>{
e.addEventListener("click",()=>{
const n=e.getAttribute("data-bs-theme-value");
i(n),
t(n),
o(n,!0)
})
})
})
})()
```
--------------------------------
### Implement Matomo analytics tracking
Source: https://reference.wordize.com/net/wordize/saveformat
This JavaScript snippet implements Matomo analytics tracking. It sets up the Matomo tracker URL and site ID, and then asynchronously loads the Matomo tracking script.
```javascript
var _paq=window._paq=window._paq||[];
_paq.push(["trackPageView"]),_paq.push(["enableLinkTracking"]),function(){
e="https://a.wordize.com/",_paq.push(["setTrackerUrl",e+"m.php"]),_paq.push(["setSiteId","11"]);
var e,n=document,t=n.createElement("script"),s=n.getElementsByTagName("script")[0];
t.async=!0,t.src=e+"m.js",s.parentNode.insertBefore(t,s)
}()
```
--------------------------------
### Configure Font Sources and Folders
Source: https://context7
Manages font availability for document rendering and conversion operations by setting font folders and custom font sources. This ensures that documents can be rendered correctly with the required fonts.
```csharp
using Wordize.Fonts;
var fontSettings = new FontSettings();
// Set single font folder
fontSettings.SetFontsFolder("C:/CustomFonts", recursive: true);
// Set multiple font folders
fontSettings.SetFontsFolders(new[] {
"C:/Fonts/Primary",
"C:/Fonts/Fallback",
"/usr/share/fonts"
}, recursive: true);
// Add custom font sources
var sources = new FontSourceBase[] {
new SystemFontSource(),
new FolderFontSource("C:/CustomFonts", true),
new FileFontSource("C:/Fonts/SpecialFont.ttf"),
new MemoryFontSource(fontBytes)
};
fontSettings.SetFontsSources(sources);
// Use in conversion
var context = new ProcessorContext {
FontSettings = fontSettings
};
```
--------------------------------
### Wordize Loading Module
Source: https://context7_llms
Responsible for loading input documents in various formats with configurable load options, such as password, encoding, and import settings.
```APIDOC
## Wordize.Loading Module
### Description
Handles the loading of input documents in multiple formats, supporting configurable options like password protection, encoding, and import settings.
### Endpoint
/wordize.loading
```
--------------------------------
### Convert Documents to Image Sequences in C#
Source: https://context7
Converts each page of a document into individual image files. Supports default PNG output and custom JPEG output with quality settings, resolution, and scaling. Useful for document previews and thumbnails. Requires the Wordize.Converting namespace.
```csharp
using Wordize.Converting;
// Convert to default format (PNG)
Converter.ConvertToImages("document.docx", "output-folder/");
// Expected: Creates output-folder/page-001.png, page-002.png, etc.
// Convert to JPEG with quality settings
var imageOptions = new ImageSaveOptions(SaveFormat.Jpeg) {
JpegQuality = 95,
Resolution = 300,
Scale = 1.5f
};
using var converter = Converter.Create();
converter.From("document.docx")
.ConvertToImages("output-folder/", imageOptions);
// Expected: High-quality JPEG images at 300 DPI, scaled 1.5x
```
--------------------------------
### Summarize Documents with AI in C#
Source: https://context7
Generates summaries of documents using AI models like OpenAI and Anthropic Claude. Allows configuration of summary length and style preservation. Requires the Wordize.AI namespace and an API key for the chosen AI model.
```csharp
using Wordize.AI;
// Create AI model connection
var model = OpenAiModel.Create("your-api-key", "gpt-4");
// Simple summarization
var summarizer = Summarizer.Create(model);
summarizer.Summarize("lengthy-document.docx", "summary.docx");
// Advanced summarization with options
using var summarizerContext = new SummarizerContext();
summarizerContext.SummarizeOptions = new SummarizeOptions {
SummaryLength = SummaryLength.Medium // VeryShort, Short, Medium, Long
};
summarizer.From("report.docx")
.To("executive-summary.docx")
.Context(summarizerContext)
.Execute();
// Expected: Creates concise summary maintaining key points and structure
// Summarize using Anthropic Claude
var claude = AnthropicAiModel.Create("your-api-key", "claude-3-opus-20240229");
var claudeSummarizer = Summarizer.Create(claude);
claudeSummarizer.Summarize("document.docx", "summary.docx");
```
--------------------------------
### Compare Documents and Highlight Differences
Source: https://context7
Compares two document versions to generate a comparison report detailing insertions, deletions, and formatting changes. Supports various comparison granularities (character, word) and options to ignore specific changes like formatting or comments. Can also output comparisons as images.
```csharp
using Wordize.Comparing;
// Simple comparison
Comparer.Compare("original.docx", "revised.docx", "comparison.docx");
// Expected: Document with tracked changes showing all differences
// Advanced comparison with options
var options = new CompareOptions {
Granularity = Granularity.WordLevel, // CharLevel or WordLevel
CompareMoves = true, // Track moved content
IgnoreFormatting = false, // Include formatting changes
IgnoreComments = true, // Skip comment comparison
IgnoreCaseChanges = true // Ignore case differences
};
using var comparer = Comparer.Create();
comparer.From("version1.docx")
.To("version2.docx")
.Author("John Doe")
.DateTime(DateTime.Now)
.CompareOptions(options)
.Execute("comparison-report.docx");
// Expected: Detailed comparison report with author and timestamp
// Compare and output as images for visual review
Comparer.CompareToImages("doc1.docx", "doc2.docx", "comparison-folder/");
```
--------------------------------
### Configure Wordize License in .NET
Source: https://reference.wordize.com/net/wordize/settings
Demonstrates how to license the Wordize component in .NET by calling the static SetLicense method with file paths to license files. This method can accept either a Stream or a string representing the file path.
```csharp
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_Core_for_.NET.lic"));
// Formats
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_Rendering_for_.NET.lic"));
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_OpenOffice_for_.NET.lic"));
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_Web_for_.NET.lic"));
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_eBook_for_.NET.lic"));
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_PDF_Load_for_.NET.lic"));
// Features
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_Comparison_for_.NET.lic"));
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_Signature_for_.NET.lic"));
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_Mail_Merge_for_.NET.lic"));
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_Merge_for_.NET.lic"));
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_Replacement_for_.NET.lic"));
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_Splitter_for_.NET.lic"));
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_Watermark_for_.NET.lic"));
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_LINQ_Reporting_Engine_for_.NET.lic"));
Wordize.Settings.SetLicense(Path.Combine(LicenseDir, @"Wordize\Wordize_AI_for_.NET.lic"));
```
--------------------------------
### Configure PDF Export Options
Source: https://context7
Customizes PDF output settings, including PDF/A compliance, font embedding, image compression, and encryption. Allows specific page selection and bookmark configuration for the output PDF.
```csharp
using Wordize.Saving;
var pdfOptions = new PdfSaveOptions {
// PDF/A compliance
Compliance = PdfCompliance.PdfA1b, // PdfA1a, PdfA1b, PdfA2a, etc.
// Font settings
EmbedFullFonts = true,
FontEmbeddingMode = PdfFontEmbeddingMode.EmbedAll,
// Image compression
ImageCompression = PdfImageCompression.Jpeg,
JpegQuality = 90, // 0-100
// Optimization
OptimizeOutput = true,
// Page selection
PageSet = new PageSet(new[] { 1, 2, 3, 5, 7 }),
// Encryption
EncryptionDetails = new PdfEncryptionDetails {
UserPassword = "user123",
OwnerPassword = "owner456",
Permissions = PdfPermissions.Printing | PdfPermissions.ModifyContents
},
// Bookmarks
OutlineOptions = new OutlineOptions {
HeadingsOutlineLevels = 3,
BookmarksOutlineLevel = 2
}
};
Converter.Convert("document.docx", "output.pdf", pdfOptions);
// Expected: PDF/A-1b compliant, encrypted PDF with bookmarks
```
--------------------------------
### Manage color theme using localStorage and media queries
Source: https://reference.wordize.com/net/wordize
This JavaScript snippet manages the color theme (light, dark, auto) of a web page using localStorage and media queries. It allows users to select a theme, stores it in localStorage, and applies it to the document. It also listens for changes in the user's preferred color scheme.
```javascript
(()=>{"use strict";const n="td-color-theme",s=()=>localStorage.getItem(n),i=e=>localStorage.setItem(n,e),e=()=>{const e=s();return e?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},t=e=>{e==="auto"?document.documentElement.setAttribute("data-bs-theme",window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"):document.documentElement.setAttribute("data-bs-theme",e)};t(e());const o=(e,t=!1)=>{const s=document.querySelector("#bd-theme");if(!s)return;const o=document.querySelector("#bd-theme-text"),i=document.querySelector(".theme-icon-active use"),n=document.querySelector(`\[data-bs-theme-value="${e}"\]`),a=n.querySelector("svg use").getAttribute("href");if(document.querySelectorAll(`\[data-bs-theme-value\]`).forEach(e=>{e.classList.remove("active"),e.setAttribute("aria-pressed","false")}),n.classList.add("active"),n.setAttribute("aria-pressed","true"),i.setAttribute("href",a),o){const e=`${o.textContent} (${n.dataset.bsThemeValue})`;s.setAttribute("aria-label",e)}};window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{const n=s();n!=="light"&&n!=="dark"&&t(e())}),window.addEventListener("DOMContentLoaded",()=>{o(e()),document.querySelectorAll(`\[data-bs-theme-value\]`).forEach(e=>{e.addEventListener("click",()=>{const n=e.getAttribute("data-bs-theme-value");i(n),t(n),o(n,!0)})})})})()
```
--------------------------------
### Configure Document Layout Options in C#
Source: https://context7
Sets up layout options for document rendering, including hidden text, paragraph marks, comment display, and revision tracking appearance. It also configures text shaping and font metric handling. This configuration is used within a ProcessorContext.
```csharp
using Wordize.Layout;
var layoutOptions = new LayoutOptions {
// Show/hide elements
ShowHiddenText = false,
ShowParagraphMarks = true,
CommentDisplayMode = CommentDisplayMode.ShowInBalloons,
// Revision options
RevisionOptions = new RevisionOptions {
InsertedTextColor = RevisionColor.BrightGreen,
InsertedTextEffect = RevisionTextEffect.Bold,
DeletedTextColor = RevisionColor.Red,
DeletedTextEffect = RevisionTextEffect.StrikeThrough,
MovedTextColor = RevisionColor.Blue,
ShowRevisionBars = true,
RevisionBarsPosition = HorizontalAlignment.Right,
ShowInBalloons = RevisionType.Deletion | RevisionType.Formatting
},
// Text rendering
EnableTextShaping = true,
KeepOriginalFontMetrics = false,
IgnorePrinterMetrics = true
};
var context = new ProcessorContext {
LayoutOptions = layoutOptions
};
// Expected: Document rendered with revision tracking visible
```
--------------------------------
### Convert Documents Between Formats in C#
Source: https://context7
Converts documents between various formats like DOCX, PDF, HTML, and RTF. Supports simple file-to-file conversion, stream-based conversion, and advanced options for PDF output, including compliance and image compression. Requires the Wordize.Converting namespace.
```csharp
using Wordize.Converting;
// Simple file-to-file conversion
Converter.Convert("document.docx", "output.pdf");
// Convert with specific format
Converter.Convert("input.html", "output.docx", SaveFormat.Docx);
// Stream-based conversion
using var inputStream = File.OpenRead("document.docx");
using var outputStream = File.Create("output.pdf");
Converter.Convert(inputStream, outputStream, SaveFormat.Pdf);
// Advanced conversion with configuration
using var converter = Converter.Create();
var pdfOptions = new PdfSaveOptions {
Compliance = PdfCompliance.PdfA1b,
EmbedFullFonts = true,
ImageCompression = PdfImageCompression.Jpeg,
JpegQuality = 90,
OptimizeOutput = true
};
converter.From("input.docx")
.To("output.pdf", pdfOptions)
.Execute();
// Expected: Creates PDF/A-1b compliant output with embedded fonts
```
--------------------------------
### FontSettings API
Source: https://reference.wordize.com/net/wordize
Manages font settings, including sources, folders, and cache.
```APIDOC
## FontSettings
### Description
Provides methods for managing font sources, folders, and search cache.
### Methods
- `GetFontsSources()`: Retrieves the current font sources.
- `ResetFontSources()`: Resets the font sources to their default configuration.
- `SaveSearchCache()`: Saves the current font search cache.
- `SetFontsFolder(folderPath)`: Sets a single folder for font searching.
- `SetFontsFolders(folderPaths)`: Sets multiple folders for font searching.
- `SetFontsSources(fontSources)`: Sets the font sources directly.
### Endpoint
/net/wordize.fonts/fontsettings/
```
--------------------------------
### Wordize Layout Module
Source: https://context7_llms
Controls the layout engine and pagination logic, managing the positioning of text, images, page breaks, nesting, and flow formatting.
```APIDOC
## Wordize.Layout Module
### Description
Manages the layout engine and pagination, controlling text and image positioning, page breaks, nesting, and flow formatting.
### Endpoint
/wordize.layout
```
--------------------------------
### Configure Image Save Options
Source: https://context7
Specifies image format, resolution, quality, and page selection for image-based output. Supports PNG, JPEG, and TIFF with various quality and compression settings.
```csharp
using Wordize.Saving;
var imageOptions = new ImageSaveOptions(SaveFormat.Png) {
// Resolution
Resolution = 300, // DPI
// Image quality (for JPEG)
JpegQuality = 95,
// Color mode
ColorMode = ImageColorMode.Grayscale, // Normal, Grayscale
// Scale
Scale = 1.5f, // 150% size
// Page selection
PageSet = new PageSet(new PageRange(1, 10)), // Pages 1-10
// TIFF compression
TiffCompression = TiffCompression.Lzw,
// Paper color
PaperColor = Color.White
};
Converter.Convert("document.docx", "output.png", imageOptions);
// Expected: High-resolution PNG images at 300 DPI
```
--------------------------------
### Wordize Converting Module
Source: https://context7_llms
Handles document format conversions (e.g., DOCX to PDF, HTML, images), preserving layout, formatting, and content across different output types.
```APIDOC
## Wordize.Converting Module
### Description
Manages document format conversions (e.g., DOCX to PDF, HTML, images), ensuring preservation of layout, formatting, and content.
### Endpoint
/wordize.converting
```
--------------------------------
### Sign Document with Digital Certificate
Source: https://context7
Applies digital signatures to documents using a digital certificate for authentication and integrity. It requires the Wordize.DigitalSignatures namespace and allows configuration of signature comments, time, and digital signature level. Certificates can be loaded from PFX files or byte arrays.
```csharp
using Wordize.DigitalSignatures;
// Load certificate
var cert = CertificateHolder.Create("certificate.pfx", "password");
var signOptions = new SignOptions {
Comments = "Approved by Director",
SignTime = DateTime.Now,
XmlDsigLevel = XmlDsigLevel.XmlDsig,
DecryptionPassword = null // If document is encrypted
};
var signer = Signer.Create();
signer.From("contract.docx")
.To("signed-contract.docx")
.CertificateHolder(cert)
.SignOptions(signOptions)
.Execute();
// Expected: Digitally signed document with valid signature
// Sign from certificate bytes
var certBytes = File.ReadAllBytes("cert.pfx");
var certFromBytes = CertificateHolder.Create(certBytes, "password");
```
--------------------------------
### Configure HTML Export Options
Source: https://context7
Controls HTML output format, CSS handling, image export, and document splitting options. Specifies external CSS, image folder, and pretty formatting.
```csharp
using Wordize.Saving;
var htmlOptions = new HtmlSaveOptions {
// CSS style handling
CssStyleSheetType = HtmlCssStyleSheetType.External,
CssStyleSheetFileName = "styles.css",
// Document splitting
DocumentSplitCriteria = DocumentSplitCriteria.HeadingParagraph,
DocumentSplitHeadingLevel = 2,
// Image export
ExportImagesAsBase64 = false,
ImagesFolder = "images",
ImagesFolderAlias = "img",
// Content options
ExportHeadersFootersMode = ExportHeadersFootersMode.PerSection,
ExportListLabels = ExportListLabels.AsInlineText,
ExportTocPageNumbers = true,
// Pretty print HTML
PrettyFormat = true,
// Image resolution
ImageResolution = 96 // DPI
};
Converter.Convert("document.docx", "output.html", htmlOptions);
// Expected: HTML with external CSS and images in separate folder
```
--------------------------------
### FontSettings API
Source: https://reference.wordize.com/net/wordize/loadformat
Provides methods for managing font sources, including setting folders, retrieving sources, and resetting caches.
```APIDOC
## FontSettings API
### Description
Manages font settings, including retrieving and resetting font sources, and setting font folders.
### Methods
- **GetFontsSources**: Retrieves the current font sources.
- **ResetFontSources**: Resets the font sources to their default state.
- **SaveSearchCache**: Saves the search cache for font sources.
- **SetFontsFolder**: Sets a single folder to search for fonts.
- **SetFontsFolders**: Sets multiple folders to search for fonts.
- **SetFontsSources**: Sets the font sources directly.
### Endpoint
`/llmstxt/reference_wordize_llms_txt/net/wordize.fonts/fontsettings/`
```
--------------------------------
### SystemFontSource API
Source: https://reference.wordize.com/net/wordize/loadformat
Represents a font source that loads fonts from the system.
```APIDOC
## SystemFontSource API
### Description
Represents a font source that loads fonts installed on the system. It provides a method to get system font folders.
### Methods
- **GetSystemFontFolders**: Retrieves a list of system font folders.
### Endpoint
`/llmstxt/reference_wordize_llms_txt/net/wordize.fonts/systemfontsource/`
```
--------------------------------
### ReplacerContext API
Source: https://reference.wordize.com/net
Documentation for the ReplacerContext class and its related methods and options for managing replacement configurations.
```APIDOC
## ReplacerContext Class
### Description
Manages the context and options for text replacement operations.
### Methods
#### ReplacerContext Constructor
* **Endpoint**: `/net/wordize.replacing/replacercontext/replacercontext/`
* **Method**: Not specified
* **Description**: Initializes a new instance of the ReplacerContext class.
#### FindReplaceOptions
* **Endpoint**: `/net/wordize.replacing/replacercontext/findreplaceoptions/`
* **Method**: Not specified
* **Description**: Defines options for finding and replacing text within the context.
#### SetReplacement
* **Endpoint**: `/net/wordize.replacing/replacercontext/setreplacement/`
* **Method**: Not specified
* **Description**: Sets a specific replacement rule within the ReplacerContext.
```
--------------------------------
### Wordize Reporting Module
Source: https://context7_llms
Offers a LINQ-based reporting engine that allows developers to bind structured data (JSON, XML, objects) into templates to generate dynamic reports.
```APIDOC
## Wordize.Reporting Module
### Description
Features a LINQ-based reporting engine for binding structured data (JSON, XML, objects) to templates to generate dynamic reports.
### Endpoint
/wordize.reporting
```
--------------------------------
### Load Password-Protected Documents
Source: https://context7
Opens encrypted or password-protected documents for processing. Requires specifying the password and optionally the load format and recovery mode.
```csharp
using Wordize.Loading;
var loadOptions = new LoadOptions {
Password = "secret123",
LoadFormat = LoadFormat.Docx, // Explicit format
Encoding = Encoding.UTF8,
RecoveryMode = DocumentRecoveryMode.Consistent
};
// Load with options
using var stream = File.OpenRead("protected.docx");
var processor = Processor.From(stream, loadOptions);
processor.To("output.pdf").Execute();
// Expected: Successfully opens and converts protected document
```
--------------------------------
### SystemFontSource API
Source: https://reference.wordize.com/net/wordize
Represents a font source that accesses system-installed fonts.
```APIDOC
## SystemFontSource
### Description
Represents a font source that accesses fonts installed on the operating system. Provides a method to retrieve system font folders.
### Methods
- `GetSystemFontFolders()`: Retrieves a list of folders where system fonts are located.
### Endpoint
/net/wordize.fonts/systemfontsource/
```
--------------------------------
### Wordize Comparing Module
Source: https://context7_llms
Enables comparison of two documents, highlighting differences (insertions, deletions, style changes) and generating comparison reports.
```APIDOC
## Wordize.Comparing Module
### Description
Facilitates document comparison, highlighting differences (insertions, deletions, style changes) and generating comparison reports.
### Endpoint
/wordize.comparing
```
--------------------------------
### FontSubstitutionSettings API
Source: https://reference.wordize.com/net/wordize/loadformat
Manages various types of font substitution settings.
```APIDOC
## FontSubstitutionSettings API
### Description
Manages different types of font substitution settings, including default, FontConfig, FontInfo, FontName, and Table substitutions.
### Properties
- **DefaultFontSubstitution** (FontSubstitutionRule) - The default font substitution rule.
- **FontConfigSubstitution** (FontSubstitutionRule) - The FontConfig-based font substitution rule.
- **FontInfoSubstitution** (FontSubstitutionRule) - The FontInfo-based font substitution rule.
- **FontNameSubstitution** (FontSubstitutionRule) - The FontName-based font substitution rule.
- **TableSubstitution** (TableSubstitutionRule) - The table-based font substitution rule.
### Endpoint
`/llmstxt/reference_wordize_llms_txt/net/wordize.fonts/fontsubstitutionsettings/`
```
--------------------------------
### Build Report from CSV Data in C#
Source: https://context7
Creates reports using CSV data with configurable parsing options, including delimiter, header presence, and comment characters. It sets up a CSV data source and report builder options before generating the report. The output is a sales report document.
```csharp
using Wordize.Reporting;
var csvOptions = new CsvDataLoadOptions {
Delimiter = ',',
HasHeaders = true,
CommentChar = '#'
};
var csvSource = new CsvDataSource("sales-data.csv", csvOptions);
var reportOptions = new ReportBuilderOptions {
RemoveEmptyParagraphs = true,
InlineErrorMessages = false,
AllowMissingMembers = true
};
var builder = ReportBuilder.Create();
builder.DataSources.Add("sales", csvSource);
builder.ReportBuilderOptions(reportOptions)
.From("sales-report-template.docx")
.To("monthly-sales-report.docx")
.BuildReport();
// Expected: Data-driven sales report from CSV data
```
--------------------------------
### FontSubstitutionSettings API
Source: https://reference.wordize.com/net/wordize
Manages various font substitution settings.
```APIDOC
## FontSubstitutionSettings
### Description
Manages different types of font substitution settings, including default, FontConfig, FontInfo, FontName, and Table substitutions.
### Properties
- `DefaultFontSubstitution`: Gets or sets the default font substitution rule.
- `FontConfigSubstitution`: Gets or sets the FontConfig-based substitution rule.
- `FontInfoSubstitution`: Gets or sets the FontInfo-based substitution rule.
- `FontNameSubstitution`: Gets or sets the FontName-based substitution rule.
- `TableSubstitution`: Gets or sets the Table-based substitution rule.
### Endpoint
/net/wordize.fonts/fontsubstitutionsettings/
```
--------------------------------
### Translate Documents with AI in C#
Source: https://context7
Translates document content using AI language models while preserving formatting and structure. Supports various languages. Requires the Wordize.AI namespace and an API key for the AI model. Can output translated content as files or images.
```csharp
using Wordize.AI;
// Setup AI model
var model = OpenAiModel.Create("your-api-key", "gpt-4");
var translator = Translator.Create(model);
// Translate to Spanish
using var context = new TranslatorContext {
Language = Language.Spanish
};
translator.From("english-document.docx")
.To("spanish-document.docx")
.Context(context)
.Execute();
// Expected: Fully translated document maintaining all formatting
// Translate and output as images
translator.From("document.docx")
.TranslateToImages("output-folder/", context);
// Supported languages include: English, Spanish, French, German,
// Italian, Portuguese, Russian, Chinese, Japanese, Korean, and more
```
--------------------------------
### Wordize Core Module
Source: https://context7_llms
The core module of the Wordize .NET SDK. It provides foundational abstractions, licensing mechanisms, format enumeration (LoadFormat, SaveFormat), global settings, and shared utilities for all other modules.
```APIDOC
## Wordize Core Module
### Description
Provides foundational abstractions, licensing mechanisms, format enumeration (LoadFormat, SaveFormat), global settings, and shared utilities for all other modules.
### Endpoint
/wordize
```
--------------------------------
### Build Report from XML Data in C#
Source: https://context7
Generates reports using XML data sources, allowing LINQ query expressions within templates. It reads data from an XML file and configures the report builder. The output is an employee directory document populated with XML data.
```csharp
using Wordize.Reporting;
var xmlData = @"
Alice Johnson
Engineering
95000
Bob Smith
Marketing
75000
";
File.WriteAllText("employees.xml", xmlData);
var xmlSource = new XmlDataSource("employees.xml");
var builder = ReportBuilder.Create();
builder.DataSources.Add("staff", xmlSource);
builder.From("employee-directory-template.docx")
.To("employee-directory.docx")
.BuildReport();
// Expected: Employee directory with filtered, sorted employee data
// Template can use LINQ queries:
// < e.Name)]>>
// <<[emp.Name]>> - <<[emp.Department]>> - $< <[emp.Salary]>>
// <>
```
--------------------------------
### Build Report from JSON Data in C#
Source: https://context7
Generates dynamic reports from JSON data using LINQ-based templates. It loads data from a JSON file and configures the report builder with data sources. The output is a report document populated with JSON data.
```csharp
using Wordize.Reporting;
// JSON data file
var jsonData = @"{
'Company': 'Tech Solutions Inc',
'Quarter': 'Q4 2024',
'Revenue': 2500000,
'Customers': [
{ 'Name': 'Client A', 'Sales': 500000, 'Growth': 15.5 },
{ 'Name': 'Client B', 'Sales': 350000, 'Growth': 22.3 },
{ 'Name': 'Client C', 'Sales': 425000, 'Growth': 18.7 }
]
}";
File.WriteAllText("data.json", jsonData);
var jsonSource = new JsonDataSource("data.json");
var builder = ReportBuilder.Create();
builder.DataSources.Add("report", jsonSource);
builder.From("quarterly-report-template.docx")
.To("Q4-2024-report.docx")
.BuildReport();
// Expected: Report with data-driven tables, charts, and summaries
// Template uses LINQ syntax like:
// Company: <<[report.Company]>>
// <>
// <<[customer.Name]>>: $< <[customer.Sales]>>
// <>
```
--------------------------------
### Configure Font Fallback for Unicode
Source: https://context7
Sets up fallback fonts for complex scripts and Unicode characters not supported by primary fonts. This ensures proper rendering of various languages, emojis, and other special characters.
```csharp
using Wordize.Fonts;
var fontSettings = new FontSettings();
var fallbackSettings = fontSettings.FallbackSettings;
// Load Microsoft Office fallback rules
fallbackSettings.LoadMsOfficeFallbackSettings();
// Load Google Noto fallback fonts (comprehensive Unicode coverage)
fallbackSettings.LoadNotoFallbackSettings();
// Auto-build fallback rules
fallbackSettings.BuildAutomatic();
// Custom fallback rules for specific Unicode ranges
fallbackSettings.Load("custom-fallback-rules.xml");
// Expected: Proper rendering of Chinese, Arabic, Emoji, and other scripts
```
--------------------------------
### Wordize Saving Module
Source: https://context7_llms
Contains save/export logic, custom save options, and output handling for various target formats beyond the default conversion paths.
```APIDOC
## Wordize.Saving Module
### Description
Manages save and export operations, custom save options, and output handling for various target formats.
### Endpoint
/wordize.saving
```
--------------------------------
### Replace Text with Formatting in Document
Source: https://context7
Finds text patterns within a document and replaces them, with the option to apply specific formatting to the replacements. Supports simple text replacement, regex-based replacement, and advanced options like whole word matching and case sensitivity.
```csharp
using Wordize.Replacing;
// Simple text replacement
var replacer = Replacer.Create();
replacer.From("document.docx")
.To("updated.docx")
.SetReplacement("OldCompany", "NewCompany")
.Execute();
// Expected: All instances of "OldCompany" replaced with "NewCompany"
// Regex-based replacement
var pattern = new Regex(@"\b\d{3}-\d{3}-\d{4}\b"); // Phone numbers
replacer.SetReplacement(pattern, "XXX-XXX-XXXX")
.Execute();
// Advanced replacement with formatting
var options = new FindReplaceOptions {
FindWholeWordsOnly = true,
MatchCase = false,
UseSubstitutions = true, // Support regex capture groups
IgnoreDeleted = true, // Skip tracked deletions
IgnoreFields = false,
ReplacementFormat = new Font {
Bold = true,
Color = Color.Blue,
Size = 12
}
};
replacer.SetReplacement("important", "IMPORTANT")
.FindReplaceOptions(options)
.Execute();
// Expected: "important" → "IMPORTANT" in blue, bold text
```
--------------------------------
### Theme Toggler for Wordize API Documentation
Source: https://reference.wordize.com/net/wordize/settings
This JavaScript code manages a theme toggler for the Wordize API documentation, allowing users to switch between light, dark, and system-default themes. It saves the user's preference in local storage and applies the chosen theme to the document's root element. It also updates the UI elements associated with theme selection.
```javascript
(() => {"use strict";
const n = "td-color-theme";
const s = () => localStorage.getItem(n);
const i = e => localStorage.setItem(n, e);
const e = () => {
const e = s();
return e ? e : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
};
const t = e => {
e === "auto" ? document.documentElement.setAttribute("data-bs-theme", window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light") : document.documentElement.setAttribute("data-bs-theme", e);
};
t(e());
const o = (e, t = !1) => {
const s = document.querySelector("#bd-theme");
if (!s) return;
const o = document.querySelector("#bd-theme-text");
const i = document.querySelector(".theme-icon-active use");
const n = document.querySelector(`[data-bs-theme-value="${e}"]`);
const a = n.querySelector("svg use").getAttribute("href");
document.querySelectorAll("[data-bs-theme-value]").forEach(e => {
e.classList.remove("active");
e.setAttribute("aria-pressed", "false");
});
n.classList.add("active");
n.setAttribute("aria-pressed", "true");
i.setAttribute("href", a);
if (o) {
const e = `${o.textContent} (${n.dataset.bsThemeValue})`;
s.setAttribute("aria-label", e);
}
t && s.focus();
};
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
const n = s();
n !== "light" && n !== "dark" && t(e());
});
window.addEventListener("DOMContentLoaded", () => {
o(e());
document.querySelectorAll("[data-bs-theme-value]").forEach(e => {
e.addEventListener("click", () => {
const n = e.getAttribute("data-bs-theme-value");
i(n);
t(n);
o(n, !0);
});
});
});
})()
```
--------------------------------
### Wordize Fonts Module
Source: https://context7_llms
Manages font resources, including embedding, substitution, fallback, metrics, and global font settings applied during document rendering and conversion.
```APIDOC
## Wordize.Fonts Module
### Description
Handles font resources such as embedding, substitution, fallback mechanisms, metrics, and global font settings used in document rendering and conversion.
### Endpoint
/wordize.fonts
```
--------------------------------
### Wordize Digital Signatures Module
Source: https://context7_llms
Supports applying, verifying, and managing digital signatures and certificates to ensure document authenticity and integrity.
```APIDOC
## Wordize.DigitalSignatures Module
### Description
Enables the application, verification, and management of digital signatures and certificates to guarantee document authenticity and integrity.
### Endpoint
/wordize.digitalsignatures
```
--------------------------------
### Perform Simple Mail Merge
Source: https://context7
Executes template-based document generation with data binding from objects or data sources. Uses a simple data object to populate merge fields in a template document.
```csharp
using Wordize.MailMerging;
// Simple data object
var customer = new {
CustomerName = "John Doe",
Address = "123 Main St",
City = "New York",
OrderDate = DateTime.Now,
TotalAmount = 1250.00m
};
var merger = MailMerger.Create();
merger.SetSimpleDataSource(customer)
.From("invoice-template.docx")
.To("invoice-2024-001.docx")
.Execute();
// Expected: Personalized invoice with customer data filled in
// Template uses fields like: { MERGEFIELD CustomerName }
```
--------------------------------
### Wordize Watermarking Module
Source: https://context7_llms
Allows you to add watermarks (text or image) to documents to assert ownership or usage constraints.
```APIDOC
## Wordize.Watermarking Module
### Description
Provides functionality to add text or image watermarks to documents, indicating ownership or usage restrictions.
### Endpoint
/wordize.watermarking
```