当前位置:网站首页>Laravel uses phpword to generate word documents
Laravel uses phpword to generate word documents
2022-06-26 04:22:00 【Scholar and】
One : install phpword Class library
composer require phpoffice/phpword
Report errors :(composer require Out of installation memory )
Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes)
Re install :( Temporarily allocate unlimited memory for installation )
php -d memory_limit=-1 composer require phpoffice/phpword
Two : introduce phpword class
use PhpOffice\PhpWord\PhpWord;
3、 ... and : establish word file
$phpWord = new PhpWord();
$phpWord->setDefaultFontName(' In black ');// Set the font
$phpWord->setDefaultFontSize(13);// Font size
$section = $phpWord->addSection();// Create a blank page
$section->addTitle(' This is a title, ');
$section->addTextBreak();// Blank line
$section->addText(' Inline text ');
$writer = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');// Generate the file
$files = 'test.docx';
$writer->save($files);
$name = basename($files);// file name (test)
return response()->download($files, $name, $headers = ['Content-Type'=>'application/zip;charset=utf-8']);// Download the file
边栏推荐
- Sorting out the examination sites of the 13th Blue Bridge Cup single chip microcomputer objective questions
- Tp6 multi table Association (table a is associated with table B, table B is associated with table C, and table d)
- PIP batch complete uninstall package
- Simple personal summary of tp6 multi application deployment -- Part I [original]
- [Nuggets' operation routine disclosure] the routine of being truly Nuggets
- Knowledge about SQL - DML
- CTF PHP audit bypasses filtering learning from topics
- Laravel access error could not be opened
- mysql自带的性能测试工具mysqlslap执行压力测试
- 2021/11/6-burpsuit packet capturing and web page source code modification
猜你喜欢

Gateway can not connect to tcp://127.0.0.1: Connection refused

Zeromq from getting started to mastering

Capture packets (Wireshark)

2021/11/6-burpsuit packet capturing and web page source code modification
![[Qunhui] this suite requires you to start PgSQL adapter service](/img/fb/1aea7eb833afc1a24531b612a98400.jpg)
[Qunhui] this suite requires you to start PgSQL adapter service

Spark - understand parquet

Install cenos in the virtual machine

College C language final exam · multiple choice questions · summary notes of mistakes and difficulties

SQL related knowledge - DDL

Unity mobile game performance optimization spectrum CPU time-consuming optimization divided by engine modules
随机推荐
BSC 及HT 等链的NFT 创造及绑定图片教程
Zhubo Huangyu: all the precious metals you want to know are here
Install dbeaver and connect Clickhouse
Spark - understand parquet
Analysis of the principle of obxwidget
Wechat applet is bound to a dynamic array to implement a custom radio box (after clicking the button, disable the button and enable other buttons)
A brain map to summarize the needs analysis (a supplement to the actual situation at work)
Gateway can not connect to tcp://127.0.0.1: Connection refused
Unity mobile game performance optimization spectrum CPU time-consuming optimization divided by engine modules
Database related knowledge
Double buffer technology asynchronous log system
CTF serialization and deserialization
SixTool-多功能多合一代挂助手源码
Alipay failed to verify the signature (sandbox test indicates fishing risk?) [original]
[Qunhui] no port access (reverse proxy + intranet penetration)
Tp6 multi table Association (table a is associated with table B, table B is associated with table C, and table d)
The stc-isp burning program for 51 single chip microcomputer always shows that "the target single chip microcomputer is being detected..." the cold start board does not respond
线程同步之条件变量
2021/11/6-burpsuit packet capturing and web page source code modification
Microsoft prohibits Russian users from downloading and installing win10/11