本文整理汇总了PHP中PHPExcel_Worksheet_MemoryDrawing::setWidth方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Worksheet_MemoryDrawing::setWidth方法的具体用法?PHP PHPExcel_Worksheet_MemoryDrawing::setWidth怎么用?PHP PHPExcel_Worksheet_MemoryDrawing::setWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Worksheet_MemoryDrawing
的用法示例。
在下文中一共展示了PHPExcel_Worksheet_MemoryDrawing::setWidth方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
//.........这里部分代码省略.........
// the first shape container never has a corresponding OBJ record, hence $n + 1
$spContainer = $allSpContainers[$n + 1];
// we skip all spContainers that are a part of a group shape since we cannot yet handle those
if ($spContainer->getNestingLevel() > 1) {
continue;
}
// calculate the width and height of the shape
list($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($spContainer->getStartCoordinates());
list($endColumn, $endRow) = PHPExcel_Cell::coordinateFromString($spContainer->getEndCoordinates());
$startOffsetX = $spContainer->getStartOffsetX();
$startOffsetY = $spContainer->getStartOffsetY();
$endOffsetX = $spContainer->getEndOffsetX();
$endOffsetY = $spContainer->getEndOffsetY();
$width = PHPExcel_Shared_Excel5::getDistanceX($this->_phpSheet, $startColumn, $startOffsetX, $endColumn, $endOffsetX);
$height = PHPExcel_Shared_Excel5::getDistanceY($this->_phpSheet, $startRow, $startOffsetY, $endRow, $endOffsetY);
// calculate offsetX and offsetY of the shape
$offsetX = $startOffsetX * PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, $startColumn) / 1024;
$offsetY = $startOffsetY * PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $startRow) / 256;
switch ($obj['type']) {
case 0x8:
// picture
// get index to BSE entry (1-based)
$BSEindex = $spContainer->getOPT(0x104);
$BSECollection = $escherWorkbook->getDggContainer()->getBstoreContainer()->getBSECollection();
$BSE = $BSECollection[$BSEindex - 1];
$blipType = $BSE->getBlipType();
// need check because some blip types are not supported by Escher reader such as EMF
if ($blip = $BSE->getBlip()) {
$ih = imagecreatefromstring($blip->getData());
$drawing = new PHPExcel_Worksheet_MemoryDrawing();
$drawing->setImageResource($ih);
// width, height, offsetX, offsetY
$drawing->setResizeProportional(false);
$drawing->setWidth($width);
$drawing->setHeight($height);
$drawing->setOffsetX($offsetX);
$drawing->setOffsetY($offsetY);
switch ($blipType) {
case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG:
$drawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG);
$drawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_JPEG);
break;
case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG:
$drawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG);
$drawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_PNG);
break;
}
$drawing->setWorksheet($this->_phpSheet);
$drawing->setCoordinates($spContainer->getStartCoordinates());
}
break;
default:
// other object type
break;
}
}
// treat SHAREDFMLA records
if ($this->_version == self::XLS_BIFF8) {
foreach ($this->_sharedFormulaParts as $cell => $baseCell) {
$formula = $this->_getFormulaFromStructure($this->_sharedFormulas[$baseCell], $cell);
$this->_phpSheet->getCell($cell)->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA);
}
}
}
// add the named ranges (defined names)
foreach ($this->_definedname as $definedName) {
示例2: getExcel
public function getExcel()
{
//load our new PHPExcel library
$this->load->library('excel');
//activate worksheet number 1
$this->excel->setActiveSheetIndex(0);
//name the worksheet
$this->excel->getActiveSheet()->setTitle('REKAPITULASI KEGIATAN PP P2TL');
//set cell A1 content with some text
$this->excel->getActiveSheet()->setCellValue('B1', 'PT PLN (PERSERO) DISTRIBUSI');
$this->excel->getActiveSheet()->setCellValue('B2', 'JAWA BARAT DAN BANTEN');
$this->excel->getActiveSheet()->setCellValue('B3', 'AREA BEKASI - RAYON BEKASI KOTA');
$this->excel->getActiveSheet()->setCellValue('A4', 'REKAPITULASI KEGIATAN PP P2TL PT .YASA EKPANSIA SEJAHTERA');
$this->excel->getActiveSheet()->setCellValue('A5', 'BULAN JUNI TAHUN 2015');
$this->excel->getActiveSheet()->setCellValue('A8', 'NO. URUT');
// Ukuran Kolom
$this->excel->getActiveSheet()->getColumnDimension('A')->setWidth(4);
// Ukuran Baris
$this->excel->getActiveSheet()->getRowDimension(1)->setRowHeight(-1);
//change the font size
$this->excel->getActiveSheet()->getStyle('B1')->getFont()->setSize(8);
$this->excel->getActiveSheet()->getStyle('B2')->getFont()->setSize(8);
$this->excel->getActiveSheet()->getStyle('B3')->getFont()->setSize(8);
$this->excel->getActiveSheet()->getStyle('A4')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('A5')->getFont()->setSize(11);
$this->excel->getActiveSheet()->getStyle('A8')->getFont()->setSize(9);
// make the font become bold
$this->excel->getActiveSheet()->getStyle('A4')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('A5')->getFont()->setBold(true);
//merge cell A1 until D1
$this->excel->getActiveSheet()->mergeCells('B1:E1');
$this->excel->getActiveSheet()->mergeCells('B2:E2');
$this->excel->getActiveSheet()->mergeCells('B3:E3');
$this->excel->getActiveSheet()->mergeCells('A4:P4');
$this->excel->getActiveSheet()->mergeCells('A5:P5');
// Merge Row
$this->excel->getActiveSheet()->mergeCells('A8:A11');
// Inserting Image
$gdImage = imagecreatefromjpeg(base_url() . 'assets/logopln.jpg');
// Add a drawing to the worksheetecho date('H:i:s') . " Add a drawing to the worksheet\n";
$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
$objDrawing->setName('Sample image');
$objDrawing->setDescription('Sample image');
$objDrawing->setImageResource($gdImage);
$objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG);
$objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
$objDrawing->setWidth(25);
$objDrawing->setHeight(60);
$objDrawing->setCoordinates('A1');
$objDrawing->setWorksheet($this->excel->getActiveSheet());
//set aligment to center for that merged cell (A1 to D1)
$this->excel->getActiveSheet()->getStyle('A4')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->excel->getActiveSheet()->getStyle('A5')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->excel->getActiveSheet()->getStyle('A8')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$filename = 'just_some_random_name.xls';
//save our workbook as this file name
header('Content-Type: application/vnd.ms-excel');
//mime type
header('Content-Disposition: attachment;filename="' . $filename . '"');
//tell browser what's the file name
header('Cache-Control: max-age=0');
//no cache
//save it to Excel5 format (excel 2003 .XLS file), change this to 'Excel2007' (and adjust the filename extension, also the header mime type)
//if you want to save it as .XLSX Excel 2007 format
$objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5');
//force user to download the Excel file without writing it to server's HD
$objWriter->save('php://output');
}
示例3: imagecreatefromjpeg
$projectDate = oci_fetch_array($projectDateParse)['PD'];
//Set properties, isi teks ini bisa anda lihat
//di file excel yang dihasilkan, klik kanan file tersebut
//dan pilih properties.
$objPHPExcel->getProperties()->setCreator("PT. Weltes Energi Nusantara")->setLastModifiedBy("{$username}")->setTitle("Site Erection Project Report for {$jobName}")->setSubject("Site Erection Project Report for {$jobName}")->setDescription("Site Erection Project Report for {$jobName}")->setKeywords("Site Erection Project Report for {$jobName}")->setCategory("Site Erection Project Report");
$gdImage = imagecreatefromjpeg('logo_weltes_resized.jpg');
// Add a drawing to the worksheetecho date('H:i:s') . " Add a drawing to the worksheet\n";
$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
$objDrawing->setName('Sample image');
$objDrawing->setDescription('Sample image');
$objDrawing->setImageResource($gdImage);
$objDrawing->setCoordinates('A1');
$objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG);
$objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
$objDrawing->setHeight(200);
$objDrawing->setWidth(200);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$styleTitle = array('font' => array('bold' => true, 'underline' => true, 'shrinkToFit' => true, 'size' => 11, 'name' => 'Trebuchet'), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER));
$styleDTNow = array('alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT));
$styleArray1 = array('font' => array('bold' => true, 'shrinkToFit' => true, 'size' => 8, 'name' => 'Verdana'));
$styleArray2 = array('font' => array('bold' => true, 'shrinkToFit' => true, 'size' => 8, 'name' => 'Verdana'), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER));
$styleArrayRight = array('alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER));
$styleBorder = array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)));
$styleBold = array('font' => array('bold' => true, 'shrinkToFit' => true, 'size' => 8, 'name' => 'Verdana'));
$styleTitle = array('font' => array('bold' => true, 'shrinkToFit' => true, 'size' => 14, 'name' => 'Verdana'), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER));
$stylefont8 = array('font' => array('size' => 8, 'name' => 'Verdana'));
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A4', "PROJECT");
$objPHPExcel->getActiveSheet()->getStyle("A4")->applyFromArray($styleArray2);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A5', "OWNER");
$objPHPExcel->getActiveSheet()->getStyle("A5")->applyFromArray($styleArray2);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A6', "CLIENT");
示例4: writeDatamatrix
protected function writeDatamatrix(Deposit $deposit, $path = null)
{
if (!$path) {
$path = dirname($this->xlsFile) . '/' . $deposit->getNumber() . '.png';
}
$key = $this->getKey($deposit);
if (!function_exists('getDataMatrix')) {
require_once __DIR__ . '/Barcode.php';
}
$im = getDataMatrix($key);
$objDrawing = new \PHPExcel_Worksheet_MemoryDrawing();
$objDrawing->setName('DATAMATRIX');
$objDrawing->setDescription('POST DATAMATRIX');
$objDrawing->setImageResource($im);
$objDrawing->setRenderingFunction(\PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG);
$objDrawing->setMimeType(\PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_PNG);
$objDrawing->setWorksheet($this->objExcel->getActiveSheet());
$objDrawing->setCoordinates('BE18');
$objDrawing->setHeight(140);
$objDrawing->setWidth(140);
$objDrawing->setResizeProportional(100);
return $path;
}
示例5: array
for ($i = 3; $i < $ca + 2; $i++) {
$ews2->setCellValue('a' . $i, "='Raw_Data'!A" . $i);
$ews2->setCellValue('b' . $i, "=B" . ($i - 1) . "+G1*('Raw_Data'!B" . $i . "-B" . ($i - 1) . ")");
$ews2->setCellValue('c' . $i, "=C" . ($i - 1) . "+G1*('Raw_Data'!C" . $i . "-C" . ($i - 1) . ")");
$ews2->setCellValue('d' . $i, "=D" . ($i - 1) . "+G1*('Raw_Data'!D" . $i . "-D" . ($i - 1) . ")");
}
$ews2->getRowDimension(1)->setRowHeight(59);
$ews2->getColumnDimension('L')->setWidth(42);
$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
$objDrawing->setName('Sample image');
$objDrawing->setDescription('Sample image');
$objDrawing->setImageResource($gdImage);
$objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG);
$objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
$objDrawing->setCoordinates('L1');
$objDrawing->setWidth(300);
$objDrawing->setHeight(38);
$objDrawing->setOffsetX(20);
$objDrawing->setOffsetY(25);
$objDrawing->setWorksheet($ews2);
$dsl2 = array(new PHPExcel_Chart_DataSeriesValues('String', 'Filtered_Data!$B$1', NULL, 1), new PHPExcel_Chart_DataSeriesValues('String', 'Filtered_Data!$C$1', NULL, 1), new PHPExcel_Chart_DataSeriesValues('String', 'Filtered_Data!$D$1', NULL, 1));
$xal2 = array(new PHPExcel_Chart_DataSeriesValues('Number', 'Filtered_Data!$A$2:$A$' . $ca, NULL, $ca));
$dsv2 = array(new PHPExcel_Chart_DataSeriesValues('Number', 'Filtered_Data!$B$2:$B$' . $ca, NULL, $ca), new PHPExcel_Chart_DataSeriesValues('Number', 'Filtered_Data!$C$2:$C$' . $ca, NULL, $ca), new PHPExcel_Chart_DataSeriesValues('Number', 'Filtered_Data!$D$2:$D$' . $ca, NULL, $ca));
$dsv2[0]->setPointMarker('none');
$dsv2[1]->setPointMarker('none');
$dsv2[2]->setPointMarker('none');
$ds2 = new PHPExcel_Chart_DataSeries(PHPExcel_Chart_DataSeries::TYPE_LINECHART, PHPExcel_Chart_DataSeries::GROUPING_STANDARD, range(0, count($dsv2) - 1), $dsl2, $xal2, $dsv2);
$pa2 = new PHPExcel_Chart_PlotArea(NULL, array($ds2));
$legend2 = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
$chart2 = new PHPExcel_Chart('chart2', NULL, $legend2, $pa2, true, 0, NULL, NULL);
$chart2->setTopLeftPosition('F3');
示例6: PHPExcel
<?php
require_once '../../../dbinfo.inc.php';
//include file PHPExcel dan konfigurasi database
require_once '../PHPExcel.php';
// Buat object PHPExcel
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("PT. Weltes Energi Nusantara")->setLastModifiedBy("1")->setTitle("Site Erection Project Report for 1")->setSubject("Site Erection Project Report for 1")->setDescription("Site Erection Project Report for 1")->setKeywords("Site Erection Project Report for 1")->setCategory("Site Erection Project Report");
$gdImage = imagecreatefromjpeg('logo_weltes_resized.jpg');
// Add a drawing to the worksheetecho date('H:i:s') . " Add a drawing to the worksheet\n";
$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
$objDrawing->setName('Sample image');
$objDrawing->setDescription('Sample image');
$objDrawing->setImageResource($gdImage);
$objDrawing->setCoordinates('B15');
$objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG);
$objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
$objDrawing->setHeight(140);
$objDrawing->setWidth(140);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="nettweight' . 1 . '_' . 2 . '.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
示例7: getReadDataOnly
/**
* Panes are frozen? (in sheet currently being read). See WINDOW2 record.
*
* @var boolean
*/
private $_frozen;
/**
* Fit printout to number of pages? (in sheet currently being read). See SHEETPR record.
*
* @var boolean
*/
private $_isFitToPages;
/**
* Objects. One OBJ record contributes with one entry.
*
* @var array
*/
private $_objs;
/**
* Text Objects. One TXO record corresponds with one entry.
*
* @var array
*/
private $_textObjects;
/**
* Cell Annotations (BIFF8)
*
* @var array
*/
private $_cellNotes;
/**
* The combined MSODRAWINGGROUP data
*
* @var string
*/
private $_drawingGroupData;
/**
* The combined MSODRAWING data (per sheet)
*
* @var string
*/
private $_drawingData;
/**
* Keep track of XF index
*
* @var int
*/
private $_xfIndex;
/**
* Mapping of XF index (that is a cell XF) to final index in cellXf collection
*
* @var array
*/
private $_mapCellXfIndex;
/**
* Mapping of XF index (that is a style XF) to final index in cellStyleXf collection
*
* @var array
*/
private $_mapCellStyleXfIndex;
/**
* The shared formulas in a sheet. One SHAREDFMLA record contributes with one value.
*
* @var array
*/
private $_sharedFormulas;
/**
* The shared formula parts in a sheet. One FORMULA record contributes with one value if it
* refers to a shared formula.
*
* @var array
*/
private $_sharedFormulaParts;
/**
* Read data only?
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
* If false (the default) it will read data and formatting.
*
* @return boolean
*/
public function getReadDataOnly()
{
return $this->_readDataOnly;
}
/**
* Set read data only
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
* Set to false (the default) to advise the Reader to read both data and formatting for cells.
*
* @param boolean $pValue
*
* @return PHPExcel_Reader_Excel5
*/
public function setReadDataOnly($pValue = false)
{
$this->_readDataOnly = $pValue;
return $this;
}
/**
* Get which sheets to load
//.........这里部分代码省略.........