我会循序渐进地调用这三个函数,确保按照指定的顺序依次执行。
问题在于,打开生成的Excel文件后,页面边距被设置为“自定义”,但实际上与我传递给函数的边距值不同。事实上,我使用了参数
另外:我无法让
我错在哪里了吗?
public function setPrintFitToWidth()
{
$this->sheet->getPageSetup()->setFitToWidth(1);
}
public function setPrintArea($cell_area)
{
$this->sheet->getPageSetup()->setPrintArea($cell_area);
}
public function setPrintMargins($top, $right, $bottom, $left)
{
$this->sheet->getPageMargins()->setTop($top);
$this->sheet->getPageMargins()->setRight($right);
$this->sheet->getPageMargins()->setLeft($left);
$this->sheet->getPageMargins()->setBottom($bottom);
}
问题在于,打开生成的Excel文件后,页面边距被设置为“自定义”,但实际上与我传递给函数的边距值不同。事实上,我使用了参数
(1,0.5,0.5,1)
调用函数,但是我得到的值是2, 0.8, 0.8, 2
,顺序相同。这真的很奇怪...另外:我无法让
setFittoWidth(1)
正常工作;我希望看到所有列都适应一页,但Excel告诉我它已经设置为自适应页面大小了。我错在哪里了吗?
.xlsx
文件。 - realtebo