有没有办法使用phpspreadsheet将占位符放入Excel文件中?

发布于 2025-01-18 19:44:51 字数 217 浏览 8 评论 0原文

有什么方法可以使用phpspreadsheet在我的Excel文件中获取占位符?我所能做的就是使用特定的单元格将我的数据放入其中 例如。 setCellvalue('a1','john') 我想将数据插入我的excel中,其中我的占位符而不是特定的单元格,寻找类似于phpword的东西 例如。 SetValue($占位符,'John')

我已经在寻找解决方案已有一段时间了,但我找不到任何功能可以帮助我。

is there any way to get placeholders in my excel file using phpspreadsheet? all I see I can do is using a specific cell to put my data into it
eg. setCellValue('A1','John')
I want to insert data into my excel where I have a placeholder not into a specific cell, looking for something similar to phpword
eg. setValue($placeholder,'John')

I've been looking for a solution for quite a while now but I can't find any function to help me out.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

压抑⊿情绪 2025-01-25 19:44:51

你可以尝试一下。

    $spreadSheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet;
    $placeholder = 'D'
    $i = 5;
    $spreadSheet->getActiveSheet()->setCellValue($placeholder . $i, 'John');

You can try it.

    $spreadSheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet;
    $placeholder = 'D'
    $i = 5;
    $spreadSheet->getActiveSheet()->setCellValue($placeholder . $i, 'John');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文