public static function PHPExcel_Shared_Excel5::sizeCol in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/Excel5.php \PHPExcel_Shared_Excel5::sizeCol()
* Get the width of a column in pixels. We use the relationship y = ceil(7x) where * x is the width in intrinsic Excel units (measuring width in number of normal characters) * This holds for Arial 10 * *
Parameters
PHPExcel_Worksheet $sheet The sheet: * @param string $col The column * @return integer The width in pixels
4 calls to PHPExcel_Shared_Excel5::sizeCol()
- PHPExcel_Reader_Excel5::load in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Reader/ Excel5.php - * Loads PHPExcel from file * *
- PHPExcel_Shared_Excel5::getDistanceX in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ Excel5.php - * Get the horizontal distance in pixels between two anchors * The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets * *
- PHPExcel_Shared_Excel5::oneAnchor2twoAnchor in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ Excel5.php - * Convert 1-cell anchor coordinates to 2-cell anchor coordinates * This function is ported from PEAR Spreadsheet_Writer_Excel with small modifications * * Calculate the vertices that define the position of the image as required by * the OBJ…
- PHPExcel_Writer_Excel5_Worksheet::_positionImage in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel5/ Worksheet.php - * Calculate the vertices that define the position of the image as required by * the OBJ record. * * +------------+------------+ * | A | B | * +-----+------------+------------+ * | |(x1,y1) | | * | 1 …
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ Excel5.php, line 46
Class
- PHPExcel_Shared_Excel5
- PHPExcel_Shared_Excel5
Code
public static function sizeCol($sheet, $col = 'A') {
// default font of the workbook
$font = $sheet
->getParent()
->getDefaultStyle()
->getFont();
$columnDimensions = $sheet
->getColumnDimensions();
// first find the true column width in pixels (uncollapsed and unhidden)
if (isset($columnDimensions[$col]) and $columnDimensions[$col]
->getWidth() != -1) {
// then we have column dimension with explicit width
$columnDimension = $columnDimensions[$col];
$width = $columnDimension
->getWidth();
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
}
else {
if ($sheet
->getDefaultColumnDimension()
->getWidth() != -1) {
// then we have default column dimension with explicit width
$defaultColumnDimension = $sheet
->getDefaultColumnDimension();
$width = $defaultColumnDimension
->getWidth();
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
}
else {
// we don't even have any default column dimension. Width depends on default font
$pixelWidth = PHPExcel_Shared_Font::getDefaultColumnWidthByFont($font, true);
}
}
// now find the effective column width in pixels
if (isset($columnDimensions[$col]) and !$columnDimensions[$col]
->getVisible()) {
$effectivePixelWidth = 0;
}
else {
$effectivePixelWidth = $pixelWidth;
}
return $effectivePixelWidth;
}