Skip to content

feat(gui): support OpenDocument templates (#138) - #219

Merged
vaceslav merged 1 commit into
mainfrom
feat/138-gui-opendocument
Sep 26, 2026
Merged

vaceslav merged 1 commit into
mainfrom
feat/138-gui-opendocument

Conversation

@vaceslav

Copy link
Copy Markdown
Contributor

Summary

The Templify GUI now accepts LibreOffice / OpenDocument templates (.odt, .ott) as well as Word templates. Processing and validation go through the format-detecting TemplateProcessor (#215). This is the last PR for #138.

Changes

  • TemplifyService: ValidateTemplateAsync and ProcessTemplateAsync use TemplateProcessor. The format is detected from the file content, and unsupported files fail with "Unsupported template format: …". The temp-file-then-move output handling is unchanged. A new internal helper, GetOutputExtension(templatePath), returns .odt for OpenDocument documents and templates and .docx otherwise. It checks the content first and falls back to the file extension for unreadable or missing files.
  • FileDialogService: the template picker has these filters: "Templates (Word, OpenDocument)" (*.docx;*.odt;*.ott, the default), "Word Documents" and "OpenDocument Text and Templates". The save dialog uses the .odt type and default extension for an .odt name, and .docx otherwise (the warning report stays .docx).
  • MainWindowViewModel:
    • The default output is <template>-output.odt for ODF input. An .ott template produces .odt.
    • The Browse Output dialog suggests the matching name.
    • An output path the user chose explicitly is kept. Only its extension switches between .docx and .odt when the new template has the other format.
  • The template field placeholder text now reads "Select a .docx, .odt or .ott template file".
  • Docs: the GUI README, the root README GUI blurb, the GUI step in examples/README.md, and a "Trying It Out" section in the LibreOffice docs page.

Tests

TriasDev.Templify.Tools.Tests (63 tests, 11 new):

  • TemplifyServiceTests:
    • an .odt and an .ott template are processed to an .odt with the …opendocument.text mimetype, validated, and leave no temp files
    • ODT validation reports errors and missing variables
    • an unsupported file fails and writes no output
    • GetOutputExtension checks the content first (an ODT named .docx gives .odt), then falls back to the file name
    • the file dialog filters and the save types
  • MainWindowViewModelTests:
    • the default output for .odt/.ott templates
    • ODT content in a file named .docx
    • a chosen output switches its extension to .odt and back
    • the Browse Output dialog suggests letter-output.odt

Local checks: the Release CI build passed. Core has 2091 tests per TFM (net10/9/8, including the LibreOffice round trips), and Converter has 95. dotnet format --verify-no-changes, dotnet pack and mkdocs build --strict passed.

Public API impact

None. The changes are in the GUI application and its tests. The library is unchanged.

Fixes #138

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 86.66667% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...riasDev.Templify.Gui/Services/FileDialogService.cs 86.66% 4 Missing ⚠️
TriasDev.Templify.Gui/Services/TemplifyService.cs 88.88% 2 Missing ⚠️
...Dev.Templify.Gui/ViewModels/MainWindowViewModel.cs 90.90% 0 Missing and 1 partial ⚠️
TriasDev.Templify.Gui/Views/MainWindow.axaml 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@vaceslav
vaceslav merged commit 5dcb0bf into main Sep 26, 2026
12 checks passed
@vaceslav
vaceslav deleted the feat/138-gui-opendocument branch September 26, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: OpenDocument Text (.odt) template support for LibreOffice / public-sector use

2 participants