本文整理汇总了PHP中PHPExcel_Worksheet::getShowGridlines方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Worksheet::getShowGridlines方法的具体用法?PHP PHPExcel_Worksheet::getShowGridlines怎么用?PHP PHPExcel_Worksheet::getShowGridlines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Worksheet
的用法示例。
在下文中一共展示了PHPExcel_Worksheet::getShowGridlines方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _writeWindow2
/**
* Write BIFF record Window2.
*/
private function _writeWindow2()
{
$record = 0x23e;
// Record identifier
$length = 0x12;
$grbit = 0xb6;
// Option flags
$rwTop = 0x0;
// Top row visible in window
$colLeft = 0x0;
// Leftmost column visible in window
// The options flags that comprise $grbit
$fDspFmla = 0;
// 0 - bit
$fDspGrid = $this->_phpSheet->getShowGridlines() ? 1 : 0;
// 1
$fDspRwCol = $this->_phpSheet->getShowRowColHeaders() ? 1 : 0;
// 2
$fFrozen = $this->_phpSheet->getFreezePane() ? 1 : 0;
// 3
$fDspZeros = 1;
// 4
$fDefaultHdr = 1;
// 5
$fArabic = $this->_phpSheet->getRightToLeft() ? 1 : 0;
// 6
$fDspGuts = $this->_outline_on;
// 7
$fFrozenNoSplit = 0;
// 0 - bit
// no support in PHPExcel for selected sheet, therefore sheet is only selected if it is the active sheet
$fSelected = $this->_phpSheet === $this->_phpSheet->getParent()->getActiveSheet() ? 1 : 0;
$fPaged = 1;
// 2
$fPageBreakPreview = $this->_phpSheet->getSheetView()->getView() === PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW;
$grbit = $fDspFmla;
$grbit |= $fDspGrid << 1;
$grbit |= $fDspRwCol << 2;
$grbit |= $fFrozen << 3;
$grbit |= $fDspZeros << 4;
$grbit |= $fDefaultHdr << 5;
$grbit |= $fArabic << 6;
$grbit |= $fDspGuts << 7;
$grbit |= $fFrozenNoSplit << 8;
$grbit |= $fSelected << 9;
$grbit |= $fPaged << 10;
$grbit |= $fPageBreakPreview << 11;
$header = pack("vv", $record, $length);
$data = pack("vvv", $grbit, $rwTop, $colLeft);
// FIXME !!!
$rgbHdr = 0x40;
// Row/column heading and gridline color index
$zoom_factor_page_break = $fPageBreakPreview ? $this->_phpSheet->getSheetView()->getZoomScale() : 0x0;
$zoom_factor_normal = $this->_phpSheet->getSheetView()->getZoomScaleNormal();
$data .= pack("vvvvV", $rgbHdr, 0x0, $zoom_factor_page_break, $zoom_factor_normal, 0x0);
$this->_append($header . $data);
}
示例2: _writePrintOptions
/**
* Write PrintOptions
*
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
* @param PHPExcel_Worksheet $pSheet Worksheet
* @throws Exception
*/
private function _writePrintOptions(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{
// printOptions
$objWriter->startElement('printOptions');
$objWriter->writeAttribute('gridLines', $pSheet->getPrintGridlines() ? 'true' : 'false');
$objWriter->writeAttribute('gridLinesSet', $pSheet->getShowGridlines() ? 'true' : 'false');
if ($pSheet->getPageSetup()->getHorizontalCentered()) {
$objWriter->writeAttribute('horizontalCentered', 'true');
}
if ($pSheet->getPageSetup()->getVerticalCentered()) {
$objWriter->writeAttribute('verticalCentered', 'true');
}
$objWriter->endElement();
}
示例3: _writeStyles
/**
* Write styles to file
*
* @param mixed $pFileHandle PHP filehandle
* @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet
* @throws Exception
*/
private function _writeStyles($pFileHandle = null, PHPExcel_Worksheet $pSheet)
{
if (!is_null($pFileHandle)) {
// Construct HTML
$html = '';
// Start styles
$html .= ' <style>' . "\r\n";
$html .= ' <!--' . "\r\n";
$html .= ' html {' . "\r\n";
$html .= ' font-family: Calibri, Arial, Helvetica, Sans Serif;' . "\r\n";
$html .= ' font-size: 10pt;' . "\r\n";
$html .= ' background-color: white;' . "\r\n";
$html .= ' }' . "\r\n";
$html .= ' table.sheet, table.sheet td {' . "\r\n";
if ($pSheet->getShowGridlines()) {
$html .= ' border: 1px dotted black;' . "\r\n";
}
$html .= ' }' . "\r\n";
// Calculate column widths
$pSheet->calculateColumnWidths();
foreach ($pSheet->getColumnDimensions() as $columnDimension) {
$column = PHPExcel_Cell::columnIndexFromString($columnDimension->getColumnIndex()) - 1;
$html .= ' td.column' . $column . ' {' . "\r\n";
$html .= ' width: ' . PHPExcel_Shared_Drawing::cellDimensionToPixels($columnDimension->getWidth()) . 'px;' . "\r\n";
if ($columnDimension->getVisible() === false) {
$html .= ' display: none;' . "\r\n";
$html .= ' visibility: hidden;' . "\r\n";
}
$html .= ' }' . "\r\n";
}
// Calculate row heights
foreach ($pSheet->getRowDimensions() as $rowDimension) {
$html .= ' tr.row' . ($rowDimension->getRowIndex() - 1) . ' {' . "\r\n";
// height is disproportionately large
$px_height = round(PHPExcel_Shared_Drawing::cellDimensionToPixels($rowDimension->getRowHeight()) / 12);
$html .= ' height: ' . $px_height . 'px;' . "\r\n";
if ($rowDimension->getVisible() === false) {
$html .= ' display: none;' . "\r\n";
$html .= ' visibility: hidden;' . "\r\n";
}
$html .= ' }' . "\r\n";
}
// Calculate cell style hashes
$cellStyleHashes = new PHPExcel_HashTable();
$cellStyleHashes->addFromSource($pSheet->getStyles());
for ($i = 0; $i < $cellStyleHashes->count(); $i++) {
$html .= $this->_createCSSStyle($cellStyleHashes->getByIndex($i));
}
// End styles
$html .= ' -->' . "\r\n";
$html .= ' </style>' . "\r\n";
// Write to file
fwrite($pFileHandle, $html);
} else {
throw new Exception("Invalid parameters passed.");
}
}
示例4: _writeWindow2
/**
* Write BIFF record Window2.
*/
private function _writeWindow2()
{
$record = 0x23e;
// Record identifier
if ($this->_BIFF_version == 0x500) {
$length = 0xa;
// Number of bytes to follow
} elseif ($this->_BIFF_version == 0x600) {
$length = 0x12;
}
$grbit = 0xb6;
// Option flags
$rwTop = 0x0;
// Top row visible in window
$colLeft = 0x0;
// Leftmost column visible in window
// The options flags that comprise $grbit
$fDspFmla = 0;
// 0 - bit
$fDspGrid = $this->_phpSheet->getShowGridlines() ? 1 : 0;
// 1
$fDspRwCol = $this->_phpSheet->getShowRowColHeaders() ? 1 : 0;
// 2
$fFrozen = $this->_phpSheet->getFreezePane() ? 1 : 0;
// 3
$fDspZeros = 1;
// 4
$fDefaultHdr = 1;
// 5
$fArabic = $this->_phpSheet->getRightToLeft() ? 1 : 0;
// 6
$fDspGuts = $this->_outline_on;
// 7
$fFrozenNoSplit = 0;
// 0 - bit
// no support in PHPExcel for selected sheet, therefore sheet is only selected if it is the active sheet
$fSelected = $this->_phpSheet === $this->_phpSheet->getParent()->getActiveSheet() ? 1 : 0;
$fPaged = 1;
// 2
$grbit = $fDspFmla;
$grbit |= $fDspGrid << 1;
$grbit |= $fDspRwCol << 2;
$grbit |= $fFrozen << 3;
$grbit |= $fDspZeros << 4;
$grbit |= $fDefaultHdr << 5;
$grbit |= $fArabic << 6;
$grbit |= $fDspGuts << 7;
$grbit |= $fFrozenNoSplit << 8;
$grbit |= $fSelected << 9;
$grbit |= $fPaged << 10;
$header = pack("vv", $record, $length);
$data = pack("vvv", $grbit, $rwTop, $colLeft);
// ---- !!!
if ($this->_BIFF_version == 0x500) {
$rgbHdr = 0x0;
// Row/column heading and gridline color
$data .= pack("V", $rgbHdr);
} elseif ($this->_BIFF_version == 0x600) {
$rgbHdr = 0x40;
// Row/column heading and gridline color index
$zoom_factor_page_break = 0x0;
$zoom_factor_normal = 0x0;
$data .= pack("vvvvV", $rgbHdr, 0x0, $zoom_factor_page_break, $zoom_factor_normal, 0x0);
}
$this->_append($header . $data);
}
示例5: _writePrintOptions
/**
* Write PrintOptions
*
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
* @param PHPExcel_Worksheet $pSheet Worksheet
* @throws Exception
*/
private function _writePrintOptions(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{
// printOptions
$objWriter->startElement('printOptions');
$objWriter->writeAttribute('gridLines', $pSheet->getShowGridlines() ? 'true' : 'false');
$objWriter->writeAttribute('gridLinesSet', 'true');
$objWriter->endElement();
}