Skip to content

Commit

Permalink
Merge pull request #3 from satthi/set_val_datatype_add
Browse files Browse the repository at this point in the history
書き込みするテキストのデータの方を指定可能とする
  • Loading branch information
satthi authored Mar 22, 2019
2 parents 147b14a + e91e776 commit 7687c7f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/PhpSpreadsheetWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,18 @@ public function __construct($template = null, $type = 'Xlsx')
* @param integer $refCol 参照セル行
* @param integer $refRow 参照セル列
* @param integer $refSheet 参照シート
* @param string $dataType 書き込みするデータの方を強制的に指定
* @author hagiwara
*/
public function setVal($value, $col, $row, $sheetNo = 0, $refCol = null, $refRow = null, $refSheet = 0)
public function setVal($value, $col, $row, $sheetNo = 0, $refCol = null, $refRow = null, $refSheet = 0, $dataType = null)
{
$cellInfo = $this->cellInfo($col, $row);
//値のセット
$this->getSheet($sheetNo)->setCellValue($cellInfo, $value);
if (is_null($dataType)) {
$this->getSheet($sheetNo)->setCellValue($cellInfo, $value);
} else {
$this->getSheet($sheetNo)->getCell($cellInfo)->setValueExplicit($value, $dataType);
}

//参照セルの指定がある場合には書式をコピーする
if (!is_null($refCol) && !is_null($refRow)) {
Expand Down

0 comments on commit 7687c7f

Please sign in to comment.