【问题标题】:Add character "-" after text in phpword在phpword文本后添加字符“-”
【发布时间】:2021-05-03 23:29:42
【问题描述】:

我正在使用 phpword 从 php 创建文件 word。 我想通过使用带有这样的文本的类 php 词来制作文件词

example text line 1
example text line 2
line 3

我想要这样的结果

example text line 1 --------------------------------------
example text line 2 --------------------------------------
line 3 ---------------------------------------------------

我不知道这条线的名称是什么,但我希望有人能帮助我。

【问题讨论】:

    标签: php ms-word phpword


    【解决方案1】:
    $lenght = 50;
    $lines = ["example text line 1","example text line 2","line 3"];
    foreach($lines as $line)
    {
      echo str_pad($line,($lenght-strlen($line)),"-");
      echo "\n";
    }
    

    【讨论】:

    • 我的问题是使用 PHPWORD... 使用 php 创建 word 文件
    猜你喜欢
    • 1970-01-01
    • 2016-02-11
    • 1970-01-01
    • 1970-01-01
    • 2016-12-18
    • 1970-01-01
    • 1970-01-01
    • 2021-11-01
    • 2014-07-19
    相关资源
    最近更新 更多