本文整理汇总了PHP中PHPExcel_Worksheet::getDefaultRowDimension方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Worksheet::getDefaultRowDimension方法的具体用法?PHP PHPExcel_Worksheet::getDefaultRowDimension怎么用?PHP PHPExcel_Worksheet::getDefaultRowDimension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Worksheet
的用法示例。
在下文中一共展示了PHPExcel_Worksheet::getDefaultRowDimension方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _writeDefaultRowHeight
/**
* Write BIFF record DEFAULTROWHEIGHT.
*/
private function _writeDefaultRowHeight()
{
$defaultRowHeight = $this->_phpSheet->getDefaultRowDimension()->getRowHeight();
if ($defaultRowHeight < 0) {
return;
}
// convert to twips
$defaultRowHeight = (int) 20 * $defaultRowHeight;
$record = 0x225;
// Record identifier
$length = 0x4;
// Number of bytes to follow
$header = pack("vv", $record, $length);
$data = pack("vv", 1, $defaultRowHeight);
$this->_append($header . $data);
}
示例2: sizeRow
/**
* Convert the height of a cell from user's units to pixels. By interpolation
* the relationship is: y = 4/3x. If the height hasn't been set by the user we
* use the default value. If the row is hidden we use a value of zero.
*
* @param PHPExcel_Worksheet $sheet The sheet
* @param integer $row The row index (1-based)
* @return integer The width in pixels
*/
public static function sizeRow($sheet, $row = 1)
{
$rowDimensions = $sheet->getRowDimensions();
// first find the true row height in pixels (uncollapsed and unhidden)
if (isset($rowDimensions[$row]) and $rowDimensions[$row]->getRowHeight() != -1) {
// then we have a row dimension
$rowDimension = $rowDimensions[$row];
$rowHeight = $rowDimension->getRowHeight();
$pixelRowHeight = (int) ceil(4 * $rowHeight / 3);
// here we assume Arial 10
} else {
if ($sheet->getDefaultRowDimension()->getRowHeight() != -1) {
// then we have a default row dimension with explicit height
$defaultRowDimension = $sheet->getDefaultRowDimension();
$rowHeight = $defaultRowDimension->getRowHeight();
$pixelRowHeight = (int) ceil(4 * $rowHeight / 3);
// here we assume Arial 10
} else {
$pixelRowHeight = 17;
// here we assume Arial 10
}
}
// now find the effective row height in pixels
if (isset($rowDimensions[$row]) and !$rowDimensions[$row]->getVisible()) {
$effectivePixelRowHeight = 0;
} else {
$effectivePixelRowHeight = $pixelRowHeight;
}
return $effectivePixelRowHeight;
}
示例3: _writeSheetFormatPr
/**
* Write SheetFormatPr
*
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
* @param PHPExcel_Worksheet $pSheet Worksheet
* @throws Exception
*/
private function _writeSheetFormatPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{
// sheetFormatPr
$objWriter->startElement('sheetFormatPr');
// Default row height
if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) {
$objWriter->writeAttribute('customHeight', 'true');
$objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
} else {
$objWriter->writeAttribute('defaultRowHeight', '12.75');
}
// Default column width
if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) {
$objWriter->writeAttribute('defaultColWidth', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth()));
}
// Outline level - row
$outlineLevelRow = 0;
foreach ($pSheet->getRowDimensions() as $dimension) {
if ($dimension->getOutlineLevel() > $outlineLevelRow) {
$outlineLevelRow = $dimension->getOutlineLevel();
}
}
$objWriter->writeAttribute('outlineLevelRow', (int) $outlineLevelRow);
// Outline level - column
$outlineLevelCol = 0;
foreach ($pSheet->getColumnDimensions() as $dimension) {
if ($dimension->getOutlineLevel() > $outlineLevelCol) {
$outlineLevelCol = $dimension->getOutlineLevel();
}
}
$objWriter->writeAttribute('outlineLevelCol', (int) $outlineLevelCol);
$objWriter->endElement();
}
示例4: sizeRow
/**
* Convert the height of a cell from user's units to pixels. By interpolation
* the relationship is: y = 4/3x. If the height hasn't been set by the user we
* use the default value. If the row is hidden we use a value of zero.
*
* @param PHPExcel_Worksheet $sheet The sheet
* @param integer $row The row index (1-based)
* @return integer The width in pixels
*/
public static function sizeRow($sheet, $row = 1)
{
// default font of the workbook
$font = $sheet->getParent()->getDefaultStyle()->getFont();
$rowDimensions = $sheet->getRowDimensions();
// first find the true row height in pixels (uncollapsed and unhidden)
if (isset($rowDimensions[$row]) and $rowDimensions[$row]->getRowHeight() != -1) {
// then we have a row dimension
$rowDimension = $rowDimensions[$row];
$rowHeight = $rowDimension->getRowHeight();
$pixelRowHeight = (int) ceil(4 * $rowHeight / 3);
// here we assume Arial 10
} else {
if ($sheet->getDefaultRowDimension()->getRowHeight() != -1) {
// then we have a default row dimension with explicit height
$defaultRowDimension = $sheet->getDefaultRowDimension();
$rowHeight = $defaultRowDimension->getRowHeight();
$pixelRowHeight = PHPExcel_Shared_Drawing::pointsToPixels($rowHeight);
} else {
// we don't even have any default row dimension. Height depends on default font
$pointRowHeight = PHPExcel_Shared_Font::getDefaultRowHeightByFont($font);
$pixelRowHeight = PHPExcel_Shared_Font::fontSizeToPixels($pointRowHeight);
}
}
// now find the effective row height in pixels
if (isset($rowDimensions[$row]) and !$rowDimensions[$row]->getVisible()) {
$effectivePixelRowHeight = 0;
} else {
$effectivePixelRowHeight = $pixelRowHeight;
}
return $effectivePixelRowHeight;
}
示例5: substr
$rgb = substr($recordData, 2 + 4 * $i, 4);
$this->_palette[] = self::_readRGB($rgb);
}
}
}
/**
* SHEET
*
* This record is located in the Workbook Globals
* Substream and represents a sheet inside the workbook.
* One SHEET record is written for each sheet. It stores the
* sheet name and a stream offset to the BOF record of the