gpt4 book ai didi

PHPExcel:打印页边距和打印自动调整似乎不起作用

转载 作者:可可西里 更新时间:2023-11-01 00:41:38 55 4
gpt4 key购买 nike

我按照这个确切的顺序一个接一个地调用这 3 个函数

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 告诉我它是在页面上的调整表上设置的。

我做错了什么?

最佳答案

已解决:

改变了

public function setPrintFitToWidth()
{
$this->sheet->getPageSetup()->setFitToWidth(1);
}

public function setPrintFitToWidth()
{
$this->sheet->getPageSetup()->setFitToWidth(1);
$this->sheet->getPageSetup()->setFitToHeight(0);
}

关于边距:我尝试使用零并且边距得到尊重,所以我得出结论,PHPExcel 单元在某种程度上“缩小”...因此,经过一些“尝试”和“重做”之后,我发现了生成的值正确的魔法

关于PHPExcel:打印页边距和打印自动调整似乎不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34789410/

55 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com