# MaltReport
PLEASE NOTE:
dev
branch to track the progress of the incoming v3 series.MaltReport is an OpenDocument/OfficeOpenXML powered document template engine for .NET and Mono, it is inspired by the excellent Relatorio Project.
There is a briefly introduction in Chinese: MaltReport2 中文使用简介
MaltReport DO NOT REQUIRES MS-Office or LibreOffice to generate document. Instead MaltReport manipulates ODT/ODS/XLS/DOC file by itself, so it could be fast & reliable.
MaltReport can be installed from NuGet.
var employees = new Employee[]
{
new Employee{ Name = "Micheal Scott", JobTitle = "Branch Manager" },
new Employee{ Name = "Pam Beesly", JobTitle = "Office Administrator" },
new Employee{ Name = "Jim Halpert", JobTitle = "Salesman" },
new Employee{ Name = "Dwight Schrute", JobTitle = "Salesman" },
new Employee{ Name = "Andy Bernard", JobTitle = "Salesman" },
};
var image = new ImageBlob("jpeg", File.ReadAllBytes("Image.jpeg"));
var data = new Dictionary<string, object>()
{
{ "employees", employees },
{ "image", image },
};
var context = new TemplateContext(data);
using (var stream = File.OpenRead("EmployeesTemplate.odt"))
{
var odt = OdfDocument.LoadFrom(stream);
var template = new OdtTemplate(odt);
var result = template.Render(context);
var desktopDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
var outputFile = Path.Combine(desktopDir, "generated.odt");
result.Save(outputFile);
}
MaltReport is licensed in the MIT license.
Author: Wei "oldrev" Li oldrev@gmail.com