Reformat column width section

This commit is contained in:
Adrien Crivelli 2017-03-10 19:56:38 +09:00
parent da9df0ba78
commit c5339b7302
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
1 changed files with 15 additions and 9 deletions

View File

@ -1039,20 +1039,26 @@ $spreadsheet->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
The measure for column width in PhpSpreadsheet does **not** correspond The measure for column width in PhpSpreadsheet does **not** correspond
exactly to the measure you may be used to in Microsoft Office Excel. exactly to the measure you may be used to in Microsoft Office Excel.
Column widths are difficult to deal with in Excel, and there are several Column widths are difficult to deal with in Excel, and there are several
measures for the column width.1) **Inner width in character units** measures for the column width.
(e.g. 8.43 this is probably what you are familiar with in Excel)2)
**Full width in pixels** (e.g. 64 pixels)3) **Full width in character 1. Inner width in character units
units** (e.g. 9.140625, value -1 indicates unset width)**PHPExcel always (e.g. 8.43 this is probably what you are familiar with in Excel)
operates with 3) "Full width in character units"** which is in fact the 2. Full width in pixels (e.g. 64 pixels)
3. Full width in character units (e.g. 9.140625, value -1 indicates unset width)
**PhpSpreadsheet always
operates with "3. Full width in character units"** which is in fact the
only value that is stored in any Excel file, hence the most reliable only value that is stored in any Excel file, hence the most reliable
measure. Unfortunately, **Microsoft Office Excel does not present you measure. Unfortunately, **Microsoft Office Excel does not present you
with this measure**. Instead measures 1) and 2) are computed by the with this measure**. Instead measures 1 and 2 are computed by the
application when the file is opened and these values are presented in application when the file is opened and these values are presented in
various dialogues and tool tips.The character width unit is the width of various dialogues and tool tips.
a '0' (zero) glyph in the workbooks default font. Therefore column
The character width unit is the width of
a `0` (zero) glyph in the workbooks default font. Therefore column
widths measured in character units in two different workbooks can only widths measured in character units in two different workbooks can only
be compared if they have the same default workbook font.If you have some be compared if they have the same default workbook font.If you have some
Excel file and need to know the column widths in measure 3), you can Excel file and need to know the column widths in measure 3, you can
read the Excel file with PhpSpreadsheet and echo the retrieved values. read the Excel file with PhpSpreadsheet and echo the retrieved values.
## Show/hide a column ## Show/hide a column