Aspose.Words ODT File Processor for .NET
The Aspose.Words ODT File Processor for .NET enables developers to create, load, edit, and save OpenOffice documents in ODT and OTT formats. Built on the core Aspose.Words engine, this plugin exposes a streamlined API surface focused on OpenOffice workflows—perfect for server-side automation, enterprise document management, and .NET integration.
Installation and Setup
Install the Aspose.Words for .NET package via NuGet.
Configure metered licensing early in your application lifecycle.
Features and Functionalities
1. Document Creation and Initialization
- Instantiate new ODT files, define styles, set up pages, and build content programmatically.
- Save directly to ODT or OTT without changing your object model usage.
2. Loading Existing Files
- Open and parse ODT/OTT files into a DOM-like object model.
- Automatic detection of source format and encoding ensures fidelity when working with custom templates.
3. Rich Content Manipulation
- Insert, update, or delete paragraphs, runs, bookmarks, and fields.
- Work with tables (rows, columns, and cells) and apply formatting.
- Insert and resize images (JPEG, PNG, GIF, and more).
4. Styles and Formatting Control
- Apply or create paragraph, character, and table styles programmatically.
- Support for inline formatting: fonts, colors, borders, indents, and spacing.
5. Template Processing with OTT
- Load OTT templates, populate placeholders, and save as ODT.
- Ideal for mail merge and automated report generation.
6. Section and Page Setup
- Control margins, orientation, headers/footers, and breaks per section.
- Manage multi-section layouts for flexible document design.
7. Metadata and Document Properties
- Read/write standard and custom properties: title, author, keywords, tags.
- Embed metadata compatible with OpenOffice and downstream systems.
8. Save Options and Performance Tuning
- Fine-tune save options (compression, compatibility settings).
- Stream-based save for minimal memory usage and direct HTTP/cloud responses.
Additional Editing Features
- Find and replace text across documents.
- Insert headings, subheadings, footnotes, and endnotes.
- Manage bookmarks, comments, and collaborative annotations.
- Create charts dynamically via
DocumentBuilder.InsertChart
. - Support for lists, bullets, tables, hyphenation, and embedded objects.
Example: Edit and Save ODT
var doc = new Document(MyDir + "Document.odt");
var builder = new DocumentBuilder(doc);
builder.MoveToDocumentEnd();
builder.Writeln("Produced by Aspose.Words Processor plugin.");
doc.Save(ArtifactsDir + "ProcessorOpenOfficePlugin.EditDocumentOpenOffice.odt");
Example: Create a Chart in ODT
var doc = new Document();
var builder = new DocumentBuilder(doc);
var shape = builder.InsertChart(ChartType.Pie, 432, 252);
var chart = shape.Chart;
chart.Title.Text = "Produced by Aspose.Words Processor plugin.";
chart.Series.Clear();
chart.Series.Add("Series 1",
new string[] { "Category 1", "Category 2", "Category 3" },
new double[] { 2.7, 3.2, 0.8 });
doc.Save(ArtifactsDir + "ProcessorOpenOfficePlugin.CreateChartOpenOffice.odt");
Example: Add a Bookmark
var doc = new Document();
var builder = new DocumentBuilder(doc);
builder.StartBookmark("Bookmark");
builder.Write("Produced by Aspose.Words Processor plugin.");
builder.EndBookmark("Bookmark");
doc.Save(ArtifactsDir + "ProcessorOpenOfficePlugin.CreateBookmarkOpenOffice.odt");
Tips and Best Practices
- Use stream-based loading/saving for very large ODT files to minimize memory consumption.
- Reuse styles across sections instead of applying direct formatting everywhere.
- Leverage OTT templates for repetitive automation tasks.
- Configure licensing at startup to avoid trial limitations.
- Validate output in multiple editors (LibreOffice, OpenOffice) to ensure cross-platform fidelity.
- Wrap document objects in
using
blocks to release unmanaged resources.
Frequently Asked Questions
What formats are supported? This processor supports ODT and OTT files. Conversion to DOCX, PDF, and other formats is available via core Aspose.Words APIs.
Is formatting preserved during save operations? Yes. Aspose.Words ensures high-fidelity rendering and formatting consistency across platforms.
Can I automate ODT mail merge? Yes. Combine OTT templates with data-binding features to generate personalized OpenOffice documents.
Which industries use the ODT File Processor? Common use cases include document management, reporting, invoice generation, publishing, retail, healthcare, and banking.