Skip to content

Easy API to create ODT documents in .NET

License

Notifications You must be signed in to change notification settings

TobiasSekan/NetOdt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NetOdt

Easy API to create ODT documents in .NET

Simple API usage (short overview)

// Needed imports
using NetOdt;
using NetOdt.Enumerations;
using System.Drawing;

// Create document (C# 8.0 syntax)
using var odtDocument = new OdtDocument(path: "E:/MyDocument.odt");

// Set global font for the all text passages for complete document
odtDocument.SetGlobalFont("Liberation Serif", FontSize.Size12);

// Set global colors for the all text passages for the complete document
odtDocument.SetGlobalFont(Color.Red, Color.Transparent);

// Set header and footer
odtDocument.SetHeader("Extend documentation", TextStyle.Center | TextStyle.Bold);
odtDocument.SetFooter("Page 2/5", TextStyle.Right | TextStyle.Italic, Color.Gray, Color.Transparent);

// Append a title
odtDocument.AppendLine("My document", TextStyle.Title, Color.Blue, Color.Black);

// Append a centered bold text
odtDocument.AppendLine("This is a bold text", TextStyle.Center | TextStyle.Bold);

// Append ten empty lines
odtDocument.AppendEmptyLines(lines: 10);

// Append a 3x3 table and fill all cells with "Fill me"
odtDocument.AppendTable(rows: 3, columns: 3, content: "Fill me");

// Append a image with a width of 22.5 cm and a height of 14.1 cm
odtDocument.AppendImage(path: "E:/picture1.jpg", width: 22.5, height: 14.1);

// The automatic dispose call (from the using syntax) do the rest of the work
// (save document, delete temporary folder, free all used resources)

// thats it :-)

Documentation

All supported styles can find here

All API calls can find here

Upcoming features

Bugs report and feature requests

Please use the GitHub issues tracker

Goals

  • Simple to use API
  • Full document API and source-code
  • Accept always primitive data-types, string and StringBuilder to write a value
  • Use enum when only specific values are except
  • Use EnumFlag for combinations of enum values (bold, italic, ...)
  • Use build-in DataTable for tables
  • No new data-types, use only build-in data-types
  • .Net Standard 2.0, C# 8.0

Releases

No releases published

Packages

No packages published

Languages