A .NET library for creating OpenDocument (ODF) files such as spreadsheets (.ods).
The C# namespace is OpenDocumentCreator (no Telani. prefix) so this drop-in
replaces existing using OpenDocumentCreator; consumers. Only the NuGet package
id carries the Telani. prefix.
<PackageReference Include="Telani.OpenDocumentCreator" Version="*" />The package is published to the
telani-app GitHub Packages feed.
Add the feed to your NuGet.Config:
<configuration>
<packageSources>
<add key="github-telani" value="https://nuget.pkg.github.com/telani-app/index.json" />
</packageSources>
<packageSourceMapping>
<packageSource key="github-telani">
<package pattern="Telani.OpenDocumentCreator" />
</packageSource>
</packageSourceMapping>
</configuration>To authenticate, set the env var
NuGetPackageSourceCredentials_github-telani to
Username=<gh-user>;Password=<PAT> where <PAT> is a classic token with the
read:packages scope.
using OpenDocumentCreator;
using OpenDocumentCreator.Styles;
using OpenDocumentCreator.DataTypes;
var doc = new OpenDocumentSpreadsheet("My App");
var header = new OpenDocumentStyle
{
Name = "Header",
Family = StyleFamily.TableCell,
TextProperties = new TextProperties { FontWeight = FontWeight.Bold },
};
doc.Styles.Add(header.Name, header);
var grid = new AutoGrid(doc, "Sheet1", nRows: 2, nColumns: 2, "30mm");
doc.Tables.Add(grid);
grid.WriteCell(0, 0, new OpenDocumentCell("Name") { Style = header });
grid.WriteCell(1, 0, new OpenDocumentCell("Value") { Style = header });
grid.WriteCell(0, 1, new OpenDocumentCell("answer"));
grid.WriteCell(1, 1, new OpenDocumentCell { FloatContent = 42 });
await using var fs = File.Create("out.ods");
await doc.Save(fs);| Path | Purpose |
|---|---|
src/ |
The library, packaged as Telani.OpenDocumentCreator. |
Tests/ |
MSTest unit tests covering AutoGrid, OpenDocumentCell, etc. |
DemoApp/ |
Console app that exercises the library end-to-end and writes a .ods to bin/.../out/planets.ods. |
dotnet restore
dotnet build
dotnet test
dotnet run --project DemoAppThe main branch is continuously deployed by .github/workflows/CD.yml. Each
push:
- Restores, builds, runs tests.
- Builds the package in
Release. - Uploads the
.nupkgas a workflow artifact. - Pushes the package to the
telani-appGitHub Packages feed.
The version comes from Nerdbank.GitVersioning
via version.json; bump the major/minor there.