【问题标题】:PhpWord spaceAfter Not WorkingPhpWord spaceAfter Not Working
【发布时间】:2016-03-03 16:17:38
【问题描述】:

我无法让 spaceAfterspaceBeforePHPWord 工作。

如果我在段落样式中包含spaceAfterspaceBefore,则该部分前后会有一些空间。

如果我确实包含spaceAfterspaceBefore,那么无论我为间距输入什么,空格都会变为0。

我可以让其他段落样式同时工作,例如lineHeight 工作正常。

示例:

$section->addText(
    "Some Text",
    array(
        "italic" => true
    ),
    array(
        "lineHeight" => 2.0,  //Works fine

        //I don't put all of these at once
        //I just want to show some of the different parameters I've used
        //And I've done the same with spaceAfter
        "spaceBefore" => 1.0,
        "spaceBefore" => "1.0",
        "spaceBefore" => .5,
        "spaceBefore" => ".5"
    )
);

【问题讨论】:

    标签: php phpword


    【解决方案1】:

    您应该将其添加为“twip”,如下所示:

    'spaceBefore' => \PhpOffice\PhpWord\Shared\Converter::pointToTwip(6))
    

    Converter 类也有方法inchToTwipcmToTwip

    关于 twip 的更多信息:

    Open Office XML 中的基本长度单位是缇。 Twip 的意思是“二十分之一英寸点”,即 1 twip = 1/1440 英寸。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-25
      • 2022-12-27
      • 1970-01-01
      • 2022-01-03
      • 2020-05-09
      • 2014-11-21
      • 2014-05-24
      • 1970-01-01
      相关资源
      最近更新 更多