Reference
Troubleshooting
Solutions to common issues when working with ODF-Report.
Placeholder not replaced
Symptom: Your [PLACEHOLDER] appears in the output document unchanged.
Cause: LibreOffice/OpenOffice sometimes inserts hidden XML markup when you edit a placeholder. Instead of a clean [USER_NAME] text node, the XML might contain something like [USER_<span>NAME</span>], which the gem can't match.
Solution: Delete the entire placeholder and retype it from scratch, including the square brackets.
Golden rule
Never edit placeholders. If you need to change [USER] to [USERNAME], don't select and modify the text. Instead, delete [USER] completely and type [USERNAME] fresh.
Additional checks:
- Verify the field name matches (names are auto-uppercased, so
add_field :user_namematches[USER_NAME]) - For
add_textplaceholders, ensure the placeholder is in its own paragraph — not inline with other content - Try opening the
.odtfile as a ZIP and inspectingcontent.xmlto see how LibreOffice encoded the placeholder text
Word found unreadable content
Symptom: You create your template in LibreOffice, but when you open the generated document in Microsoft Word, it reports "Word found unreadable content."
Solution:
- Open your template in LibreOffice
- Save as
.docxformat - Close LibreOffice
- Open the
.docxfile in LibreOffice - Save as
.odtformat - Use this new
.odtas your template
Why this works: Word doesn't support all ODF features. The round-trip through .docx removes document features that Word can't handle.
Formatting not applied to texts
Symptom: add_text content appears as plain text without bold, italic, or underline formatting.
Cause: The required character styles are not defined in your template.
Solution: Open your template in LibreOffice and create character styles named exactly bold, italic, and underline. See Texts — Template setup for step-by-step instructions.
Table not found
Symptom: Table rows are not generated, or the table is left unchanged.
Cause: The table name in your code doesn't match the table name in the template.
Solution:
- In LibreOffice, right-click the table and select Table Properties...
- Check the Name field
- Make sure it matches exactly what you pass to
add_table
Section not found
Symptom: Section content is not repeated.
Cause: The section name doesn't match, or the section wasn't created properly.
Solution:
- In LibreOffice, click inside the section
- Go to Format > Sections...
- Verify the section name matches what you pass to
add_section
Image not replaced
Symptom: The placeholder image remains in the output.
Cause: The image frame name doesn't match.
Solution:
- In LibreOffice, right-click the image
- Select Properties and go to the Options tab
- Check the Name field
- Make sure it matches what you pass to
add_image
Common mistakes
Passing an array inside a section instead of a symbol: Inside sections, use
:items(symbol) not@items(array). The symbol tells ODF-Report to call that method on each section record.Forgetting
header: true: If your table has a header row and you don't passheader: true, the header row will be treated as a template row and duplicated for each item.Editing template placeholders: Always delete and retype. Never edit in place.