当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPExcel_Worksheet::setCellValueExplicit方法代码示例

本文整理汇总了PHP中PHPExcel_Worksheet::setCellValueExplicit方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Worksheet::setCellValueExplicit方法的具体用法?PHP PHPExcel_Worksheet::setCellValueExplicit怎么用?PHP PHPExcel_Worksheet::setCellValueExplicit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPExcel_Worksheet的用法示例。


在下文中一共展示了PHPExcel_Worksheet::setCellValueExplicit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _readLabel

 /**
  * Read LABEL record
  * This record represents a cell that contains a string. In
  * BIFF8 it is usually replaced by the LABELSST record.
  * Excel still uses this record, if it copies unformatted
  * text cells to the clipboard.
  *
  * --	"OpenOffice.org's Documentation of the Microsoft
  * 		Excel File Format"
  */
 private function _readLabel()
 {
     $length = $this->_GetInt2d($this->_data, $this->_pos + 2);
     $recordData = substr($this->_data, $this->_pos + 4, $length);
     // move stream pointer to next record
     $this->_pos += 4 + $length;
     // offset: 0; size: 2; index to row
     $row = $this->_GetInt2d($recordData, 0);
     // offset: 2; size: 2; index to column
     $column = $this->_GetInt2d($recordData, 2);
     $columnString = PHPExcel_Cell::stringFromColumnIndex($column);
     // Read cell?
     if (!is_null($this->getReadFilter()) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->_phpSheet->getTitle())) {
         // offset: 4; size: 2; XF index
         $xfIndex = $this->_GetInt2d($recordData, 4);
         // add cell value
         // todo: what if string is very long? continue record
         if ($this->_version == self::XLS_BIFF8) {
             $string = $this->_readUnicodeStringLong(substr($recordData, 6));
             $value = $string['value'];
         } else {
             $string = $this->_readByteStringLong(substr($recordData, 6));
             $value = $string['value'];
         }
         $this->_phpSheet->setCellValueExplicit($columnString . ($row + 1), $value, PHPExcel_Cell_DataType::TYPE_STRING);
         // add cell style
         if (!$this->_readDataOnly) {
             $this->_phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->_mapCellXfIndex[$xfIndex]);
         }
     }
 }
开发者ID:omusico,项目名称:wildfire_php,代码行数:41,代码来源:Excel5.php

示例2: writeDCInvContent

/**
 * Write the content of the "DC Inventory" worksheet
 *
 * @param PHPExcel_Worksheet $worksheet
 * @param array $sheetProps properties of the worksheet
 * @param array $invData array with the inventory data
 */
function writeDCInvContent($worksheet, $sheetProps, $invData)
{
    $colIdx = $sheetProps['ColIdx'];
    // first line is the header for the worksheet
    $worksheet->fromArray($invData, null, 'A2');
    ReportStats::get()->report('Info', 'Number of Inventory entries ' . count($invData));
    $highestRow = count($invData);
    foreach ($sheetProps['ExpStr'] as $colName) {
        $colLetter = $colIdx[$colName][1];
        for ($row = 0; $row < $highestRow; $row++) {
            $worksheet->setCellValueExplicit($colLetter . ($row + 2), $invData[$row][$colName], PHPExcel_Cell_DataType::TYPE_STRING);
        }
    }
    // unset($invData);
}
开发者ID:dc-admin,项目名称:openDCIM,代码行数:22,代码来源:report_asset_Excel-new.php

示例3: _set_row

 /**
  * Sets cells of a single row
  * 
  * @param int $row
  * @param mixed $cell_values
  * @param boolean $header
  * @return Worksheet
  */
 private function _set_row($row, &$data, $header = FALSE)
 {
     $column = 0;
     $format = NULL;
     $type = PHPExcel_Cell_DataType::TYPE_STRING;
     foreach ($this->columns as $key => $name) {
         $value = NULL;
         if (is_array($data)) {
             $value = $data[$key];
         } elseif (is_object($data)) {
             if (method_exists($data, $key)) {
                 $value = $data->{$key}();
             } elseif (isset($data->{$key})) {
                 $value = $data->{$key};
             }
         }
         // Determine cell type and format
         if ($header === FALSE) {
             $type = Arr::get($this->types, $key);
         }
         // Set cell value
         $coordinates = PHPExcel_Cell::stringFromColumnIndex($column) . $row;
         if ($type !== NULL) {
             $this->_worksheet->setCellValueExplicit($coordinates, $value, $type);
         } else {
             $this->_worksheet->setCellValue($coordinates, $value);
         }
         $column++;
     }
     return $this;
 }
开发者ID:Vagabondtq,项目名称:kohana-phpexcel,代码行数:39,代码来源:worksheet.php

示例4: _set_row

 /**
  * Sets cells of a single row
  * 
  * @param int $row
  * @param mixed $cell_values
  * @param boolean $header
  * @return Worksheet
  */
 private function _set_row($row, &$data, $header = FALSE)
 {
     $column = 0;
     $type = PHPExcel_Cell_DataType::TYPE_STRING;
     foreach (array_keys($this->columns) as $key) {
         $value = NULL;
         if (is_array($data)) {
             $value = isset($data[$key]) ? $data[$key] : '';
         } elseif (is_object($data)) {
             if (method_exists($data, $key)) {
                 $value = $data->{$key}();
             } elseif (isset($data->{$key})) {
                 $value = $data->{$key};
             }
         }
         // Determine cell type and format
         if ($header === FALSE) {
             $type = Arr::get($this->types, $key);
         }
         $coordinates = PHPExcel_Cell::stringFromColumnIndex($column) . $row;
         // Options
         if (is_array($value)) {
             $options = array_slice($value, 1);
             $validation = $this->_worksheet->getCell($coordinates)->getDataValidation();
             $validation->setType(PHPExcel_Cell_DataValidation::TYPE_LIST);
             $validation->setAllowBlank(TRUE);
             $validation->setShowDropDown(TRUE);
             $validation->setFormula1('"' . join(',', $options) . '"');
             $value = $value[0];
         }
         // Set cell value
         if ($type !== NULL) {
             $this->_worksheet->setCellValueExplicit($coordinates, $value, $type);
         } else {
             $this->_worksheet->setCellValue($coordinates, $value);
         }
         $column++;
     }
     return $this;
 }
开发者ID:efremovich,项目名称:kohana-phpexcel,代码行数:48,代码来源:Worksheet.php


注:本文中的PHPExcel_Worksheet::setCellValueExplicit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。