PHP操作Word的组件PHPWord有两个版本


关键词

PHP Word PHPWord

摘要

PHP很简单、便捷的操作Word文档,这要归功于第三方的组件:PHPWord。其实在网上搜索会发现PHPWord有两个版本,一个版本叫PHPWord,另一个叫PhpWord。

从名字上看,细心的朋友可能已经发现其中的区别了,对的,就是有两字母大小写不同。我们一个一个来说:

PHPWord
官网:http://phpword.codeplex.com/
功能介绍:
PHPWord is a library written in PHP that create word documents. 
No Windows operating system is needed for usage because the result are docx files (Office Open XML) that can be opened by all major office software.

PHPWord is based on the fantastic PHPExcel / PHPPowerPoint libraries.
Major Features

Insert and format document sections
Insert and format Text elements
Insert Text breaks
Insert Page breaks
Insert and format Images and binary OLE-Objects
Insert and format watermarks (new)
Insert Header / Footer
Insert and format Tables
Insert native Titles and Table-of-contents
Insert and format List elements
Insert and format hyperlinks
Very simple template system (new)

PHPWord在用于操作中文时,要注意编码问题。需要对它做一些修改。


PhpWord
官网:https://github.com/PHPOffice/PHPWord
功能介绍:
With PHPWord, you can create OOXML, ODF, or RTF documents dynamically using your PHP 5.3.3+ scripts. Below are some of the things that you can do with PHPWord library:

Set document properties, e.g. title, subject, and creator.
Create document sections with different settings, e.g. portrait/landscape, page size, and page numbering
Create header and footer for each sections
Set default font type, font size, and paragraph style
Use UTF-8 and East Asia fonts/characters
Define custom font styles (e.g. bold, italic, color) and paragraph styles (e.g. centered, multicolumns, spacing) either as named style or inline in text
Insert paragraphs, either as a simple text or complex one (a text run) that contains other elements
Insert titles (headers) and table of contents
Insert text breaks and page breaks
Insert and format images, either local, remote, or as page watermarks
Insert binary OLE Objects such as Excel or Visio
Insert and format table with customized properties for each rows (e.g. repeat as header row) and cells (e.g. background color, rowspan, colspan)
Insert list items as bulleted, numbered, or multilevel
Insert hyperlinks
Insert footnotes and endnotes
Insert drawing shapes (arc, curve, line, polyline, rect, oval)
Insert charts (pie, doughnut, bar, line, area, scatter, radar)
Insert form fields (textinput, checkbox, and dropdown)
Create document from templates
Use XSL 1.0 style sheets to transform headers, main document part, and footers of an OOXML template
... and many more features on progress

从使用上说,PHPWord感觉要比PhpWord方便一些,但功能貌似后者更强大。

 

文章的版权

洪哥写文章很苦逼,如果本文对您略有帮助,点击感兴趣的广告支持洪哥!万分感谢!本文属于“洪哥笔记”原创文章,转载请注明来源地址:PHP操作Word的组件PHPWord有两个版本:http://www.splaybow.com/post/phpword-2-version-6890.html

关注与收藏

如果您在服务器运维、网络管理、网站或系统开发过程有需要提供收费服务,请加QQ:115085382!十年运维经验,帮您省钱、让您放心!
亲,如果有需要,先存起来,方便以后再看啊!加入收藏夹的话,按Ctrl+D


« PHP求最大值的max函数

相关文章:

PHP操作Word的组件PHPWord有两个版本  (2017/5/3 7:40:06)

PHP求最大值的max函数  (2017/4/21 7:43:22)

PHP求最小值的min函数  (2017/4/11 7:33:43)

PHP数组降序排序rsort()函数  (2017/3/28 7:04:09)

PHP数组升序排序sort()函数  (2017/3/25 7:02:40)

ThinkPHP中if标签的使用  (2017/1/21 7:31:57)

Thinkphp整合支付宝  (2016/10/8 9:08:19)

PHP的highlight_file显示程序源文件  (2017/1/11 7:05:58)

洪哥的ThinkPHP教程之编写列表页  (2016/6/7 7:48:14)

ThinkPHP中调用PHPExcel  (2016/12/11 7:30:07)