excellibreoffice-calcodsopendocument

How to create opendocument ods files with optimal row height


Application creates OpenDocument spreadsheets (ods file) in code. Some rows contains caption with bigger font sized. They are only partially visible if opened in LibreOffice.

All rows have same style ro1 which has style:use-optimal-row-height="true" setting:

    <style:style style:name="ro1" style:family="table-row">
   <style:table-row-properties style:use-optimal-row-height="true" fo:break-before="auto"/>
    </style:style>

This setting does not increase caption row height. All rows have same height. How to force Libreoffice Calc and Excel to select optimal height for caption rows on table open?
It is difficult to manually calculate row heights during file creation.


Solution

  • According to this bug report, this was an intentional design choice by LibreOffice coders, and it sounds like the behavior will probably not change. So other than calculating row heights during file creation, the possible solutions are:

    1. Use Apache OpenOffice, which recalculates the row when the file is opened.
    2. Write a LibreOffice macro to recalculate the row. The macro could be run automatically as part of the generation process, automatically when the file is opened, or manually with a hotkey or button.

    A similar question is here: https://ask.libreoffice.org/en/question/81629/how-to-apply-optimal-row-and-column-width-when-opening-a-calc-document/