从名字上看,细心的朋友可能已经发现其中的区别了,对的,就是有两字母大小写不同。我们一个一个来说:
官网: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方便一些,但功能貌似后者更强大。