Search code examples
exceltwigbundleautosize

Twig Excel Bundle autosize


How to set autosize in Twig Excel Bundle ? https://twigexcelbundle.readthedocs.io/en/latest/


Solution

  • You can set the default autoSize property of a sheet to true via columnDimension:

    {% xlssheet 'Worksheet' {
        columnDimension: {
            'default': {
                autoSize: true
            }
        }
    }%}
        {# ... #}
    {% endxlssheet %}
    

    To define it for a specific column, use the letter of the desired column instead of default, per example the column D:

    {% xlssheet 'Worksheet' {
        columnDimension: {
            'D': {
                autoSize: true
            }
        }
    }%}
        {# ... #}
    {% endxlssheet %}