update colWidth function
This commit is contained in:
parent
bbd9f66428
commit
61b2480cc1
@ -127,10 +127,10 @@ class Worksheet
|
|||||||
* @param float $width
|
* @param float $width
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public function setColWidth(string $col, float $width)
|
public function setColWidth(int $colFrom, int $colTo, float $width)
|
||||||
{
|
{
|
||||||
$this->throwIfSheetFilePointerIsAlreadyCreated();
|
$this->throwIfSheetFilePointerIsAlreadyCreated();
|
||||||
$this->colWidths[$col] = $width;
|
$this->colWidths[] = [$colFrom,$colTo,$width];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -165,16 +165,6 @@ class Worksheet
|
|||||||
$this->merges[] = $leftCell . ':' . $rightCell;
|
$this->merges[] = $leftCell . ':' . $rightCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* remove merged cell reference.
|
|
||||||
* @param string $leftCell
|
|
||||||
* @param string $rightCell
|
|
||||||
*/
|
|
||||||
public function unMergeCells(string $leftCell, string $rightCell)
|
|
||||||
{
|
|
||||||
$this->merges = array_diff($this->merges,[$leftCell . ':' . $rightCell]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* used by WorksheetManager to get default row height and width xml to inject into worksheet xml file
|
* used by WorksheetManager to get default row height and width xml to inject into worksheet xml file
|
||||||
* @return string
|
* @return string
|
||||||
@ -200,8 +190,8 @@ class Worksheet
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$xml = '<cols>';
|
$xml = '<cols>';
|
||||||
foreach ($this->colWidths as $col => $width) {
|
foreach ($this->colWidths as $entry) {
|
||||||
$xml .= '<col min="'.$col.'" max="'.$col.'" width="'.$width.'" style="1" customWidth="1"/>'; //style and customWidth may be unnecessary ??
|
$xml .= '<col min="'.$entry[0].'" max="'.$entry[1].'" width="'.$entry[2].'" style="1" customWidth="1"/>'; //style and customWidth may be unnecessary ??
|
||||||
}
|
}
|
||||||
$xml .= '</cols>';
|
$xml .= '</cols>';
|
||||||
return $xml;
|
return $xml;
|
||||||
|
@ -187,13 +187,14 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $col
|
* @param string $colFrom
|
||||||
|
* @param string $colTo
|
||||||
* @param float $width
|
* @param float $width
|
||||||
* @throws \Box\Spout\Common\Exception\IOException
|
* @throws \Box\Spout\Common\Exception\IOException
|
||||||
*/
|
*/
|
||||||
public function setColWidth(string $col, float $width)
|
public function setColWidth(int $colFrom, int $colTo, float $width)
|
||||||
{
|
{
|
||||||
$this->workbookManager->getCurrentWorksheet()->setColWidth($col, $width);
|
$this->workbookManager->getCurrentWorksheet()->setColWidth($colFrom, $colTo, $width);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -222,13 +223,4 @@ abstract class WriterMultiSheetsAbstract extends WriterAbstract
|
|||||||
{
|
{
|
||||||
$this->workbookManager->getCurrentWorksheet()->mergeCells($leftCell,$rightCell);
|
$this->workbookManager->getCurrentWorksheet()->mergeCells($leftCell,$rightCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $leftCell
|
|
||||||
* @param string $rightCell
|
|
||||||
*/
|
|
||||||
public function unMergeCells(string $leftCell, string $rightCell)
|
|
||||||
{
|
|
||||||
$this->workbookManager->getCurrentWorksheet()->unMergeCells($leftCell,$rightCell);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user