Skip to content

Add-on: The default and custom column size #7

@ebarchukov

Description

@ebarchukov

This line:

fwrite($fd, '<col collapsed="false" hidden="false" max="1025" min="1" style="0" width="11.5"/>');
should be:
fwrite($fd, '<col collapsed="false" hidden="false" max="1025" min="1" style="0" width="11.5" customWidth="1"/>');

And if you want to set custom column size, this block:

fwrite($fd, '<cols>');
fwrite($fd, '<col collapsed="false" hidden="false" max="1025" min="1" style="0" width="11.5"/>');
fwrite($fd, '</cols>');

Should be:

// set width for cols
fwrite($fd, '<cols>');
fwrite($fd, '<col collapsed="false" hidden="false" max="1025" min="1" style="0" width="11.5" customWidth="1"/>');
if ($this->defaultStyle)
{
foreach ($this->defaultStyle as $key => $style)
{
if (isset($style['sheet']))
{
if ($style['sheet'] == $sheet_name)
{
if (isset($style['cols_width']))
{
foreach ($style['cols_width'] as $col_width)
{
fwrite($fd, '<col min="' . $col_width[0] . '" max="' . $col_width[1] . '" width="' . $col_width[2] . '" customWidth="1"/>');
}
}
}
}
}
}
fwrite($fd, '</cols>');

and in style array:

$style = [['cols_width' => [[1, 1, 20],[2, 2, 30]]],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions