本文整理汇总了PHP中PHPExcel_Worksheet_MemoryDrawing::setResizeProportional方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Worksheet_MemoryDrawing::setResizeProportional方法的具体用法?PHP PHPExcel_Worksheet_MemoryDrawing::setResizeProportional怎么用?PHP PHPExcel_Worksheet_MemoryDrawing::setResizeProportional使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Worksheet_MemoryDrawing
的用法示例。
在下文中一共展示了PHPExcel_Worksheet_MemoryDrawing::setResizeProportional方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: load
//.........这里部分代码省略.........
foreach ($this->_objs as $n => $obj) {
// 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)
示例3: action_index
//.........这里部分代码省略.........
}
foreach ($jobs as $ticket) {
$row = array($ticket['_id']);
if (isset($static['last_update'])) {
$row[] = date('d-m-Y H:i', Arr::get($ticket, 'last_update', $ticket['created']));
}
if (isset($static['last_submit'])) {
$row[] = Arr::get($ticket, 'last_submit') ? date('d-m-Y H:i', $ticket['last_submit']) : '';
}
if (isset($static['status']) && Group::current('show_all_jobs')) {
$row[] = Arr::get(Enums::$statuses, Arr::get($ticket, 'status', 0), 'Unknown');
}
if (isset($static['types'])) {
if (Group::current('allow_assign')) {
$row[] = implode(', ', array_intersect_key($types, Arr::get($ticket, 'assigned', array())));
} else {
$row[] = implode(', ', array_intersect_key($types, array_filter(Arr::get($ticket, 'assigned', array()), function ($x) {
return $x == User::current('company_id');
})));
}
}
if (isset($static['companies'])) {
$row[] = implode(', ', array_intersect_key($companies, array_flip(Arr::get($ticket, 'assigned', array()))));
}
if (isset($static['ex'])) {
$row[] = implode(', ', array_intersect_key($companies, array_flip(Arr::get($ticket, 'ex', array()))));
}
if (isset($static['pending'])) {
$row[] = Arr::get($submissions, $ticket['_id']);
}
if (isset($static['attachments'])) {
$row[] = Arr::get($attachments, $ticket['_id']);
}
foreach (Columns::get_search() as $id => $type) {
$row[] = Arr::path($ticket, array('data', $id)) ? Columns::output($ticket['data'][$id], Columns::get_type($id), true) : '';
}
if ($action == 'excel') {
$i++;
$sheet->fromArray($row, NULL, 'A' . $i);
$x = count($row);
if (isset($attachments_list[$ticket['_id']])) {
$sheet->getRowDimension($i)->setRowHeight(80);
}
foreach (Arr::get($attachments_list, $ticket['_id'], array()) as $image) {
if (!file_exists(DOCROOT . 'storage/' . $image . '.thumb')) {
if (!file_exists(DOCROOT . 'storage/' . $image)) {
continue;
}
$data = file_get_contents(DOCROOT . 'storage/' . $image);
$er = error_reporting(0);
$img = imagecreatefromstring($data);
error_reporting($er);
if (!$img) {
continue;
}
$x = imagesx($img);
$y = imagesy($img);
$size = max($x, $y);
$x = round($x / $size * 96);
$y = round($y / $size * 96);
$thumb = imagecreatetruecolor($x, $y);
imagealphablending($thumb, false);
imagesavealpha($thumb, true);
imagecopyresampled($thumb, $img, 0, 0, 0, 0, $x, $y, imagesx($img), imagesy($img));
imagepng($thumb, DOCROOT . 'storage/' . $image . '.thumb', 9);
}
$data = file_get_contents(DOCROOT . 'storage/' . $image . '.thumb');
$img = imagecreatefromstring($data);
$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
$objDrawing->setImageResource($img);
$coord = PHPExcel_Cell::stringFromColumnIndex($x++);
$objDrawing->setCoordinates($coord . $i);
$objDrawing->setOffsetY(5);
$objDrawing->setResizeProportional(true);
$objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG);
$objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
$objDrawing->setWorksheet($sheet);
//$sheet->getCell($coord . $i)->setHyperlink(new PHPExcel_Cell_Hyperlink(URL::site('download/attachment/' . $image, 'http'), 'Show Image'));
}
} else {
fputcsv($file, $row);
}
}
if ($action == 'excel') {
$name = tempnam(sys_get_temp_dir(), 'excel');
header('Content-type: application/xlsx');
header('Content-disposition: filename="SearchResults.xlsx"');
$writer = new PHPExcel_Writer_Excel2007($excel);
$writer->save($name);
readfile($name);
unlink($name);
} else {
fseek($file, 0);
header('Content-type: text/csv');
header('Content-disposition: filename="SearchResults.csv"');
fpassthru($file);
fclose($file);
}
die;
}
示例4: 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
//.........这里部分代码省略.........