├── .gitignore ├── .scrutinizer.yml ├── .travis.yml ├── .travis_shell_after_success.sh ├── CHANGELOG.md ├── CONTRIBUTING.md ├── COPYING ├── COPYING.LESSER ├── LICENSE ├── README.md ├── VERSION ├── bootstrap.php ├── composer.json ├── docs ├── Makefile ├── conf.py ├── containers.rst ├── credits.rst ├── elements.rst ├── faq.rst ├── general.rst ├── images │ ├── phpword.png │ └── phpword.svg ├── index.rst ├── installing.rst ├── intro.rst ├── recipes.rst ├── references.rst ├── styles.rst ├── templates-processing.rst └── writersreaders.rst ├── phpmd.xml.dist ├── phpunit.xml.dist ├── phpword.ini.dist ├── samples ├── Sample_01_SimpleText.php ├── Sample_02_TabStops.php ├── Sample_03_Sections.php ├── Sample_04_Textrun.php ├── Sample_05_Multicolumn.php ├── Sample_06_Footnote.php ├── Sample_07_TemplateCloneRow.php ├── Sample_08_ParagraphPagination.php ├── Sample_09_Tables.php ├── Sample_10_EastAsianFontStyle.php ├── Sample_11_ReadWord2007.php ├── Sample_11_ReadWord97.php ├── Sample_12_HeaderFooter.php ├── Sample_13_Images.php ├── Sample_14_ListItem.php ├── Sample_15_Link.php ├── Sample_16_Object.php ├── Sample_17_TitleTOC.php ├── Sample_18_Watermark.php ├── Sample_19_TextBreak.php ├── Sample_20_BGColor.php ├── Sample_21_TableRowRules.php ├── Sample_22_CheckBox.php ├── Sample_23_TemplateBlock.php ├── Sample_24_ReadODText.php ├── Sample_25_TextBox.php ├── Sample_26_Html.php ├── Sample_27_Field.php ├── Sample_28_ReadRTF.php ├── Sample_29_Line.php ├── Sample_30_ReadHTML.php ├── Sample_31_Shape.php ├── Sample_32_Chart.php ├── Sample_33_FormField.php ├── Sample_34_SDT.php ├── Sample_35_InternalLink.php ├── Sample_36_RTL.php ├── Sample_Footer.php ├── Sample_Header.php ├── bootstrap │ ├── css │ │ ├── bootstrap.min.css │ │ ├── font-awesome.min.css │ │ └── phpword.css │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ └── fontawesome-webfont.woff │ └── js │ │ ├── bootstrap.min.js │ │ └── jquery.min.js ├── index.php ├── resources │ ├── PhpWord.png │ ├── Sample_07_TemplateCloneRow.docx │ ├── Sample_11_ReadWord2007.docx │ ├── Sample_11_ReadWord97.doc │ ├── Sample_23_TemplateBlock.docx │ ├── Sample_24_ReadODText.odt │ ├── Sample_28_ReadRTF.rtf │ ├── Sample_30_ReadHTML.html │ ├── _earth.jpg │ ├── _mars.jpg │ └── _sheet.xls └── results │ └── .gitignore ├── src └── PhpWord │ ├── Collection │ ├── AbstractCollection.php │ ├── Bookmarks.php │ ├── Charts.php │ ├── Endnotes.php │ ├── Footnotes.php │ └── Titles.php │ ├── Element │ ├── AbstractContainer.php │ ├── AbstractElement.php │ ├── Bookmark.php │ ├── Cell.php │ ├── Chart.php │ ├── CheckBox.php │ ├── Endnote.php │ ├── Field.php │ ├── Footer.php │ ├── Footnote.php │ ├── FormField.php │ ├── Header.php │ ├── Image.php │ ├── Line.php │ ├── Link.php │ ├── ListItem.php │ ├── ListItemRun.php │ ├── Object.php │ ├── PageBreak.php │ ├── PreserveText.php │ ├── Row.php │ ├── SDT.php │ ├── Section.php │ ├── Shape.php │ ├── TOC.php │ ├── Table.php │ ├── Text.php │ ├── TextBox.php │ ├── TextBreak.php │ ├── TextRun.php │ └── Title.php │ ├── Escaper │ ├── AbstractEscaper.php │ ├── EscaperInterface.php │ ├── RegExp.php │ ├── Rtf.php │ └── Xml.php │ ├── Exception │ ├── CopyFileException.php │ ├── CreateTemporaryFileException.php │ ├── Exception.php │ ├── InvalidImageException.php │ ├── InvalidObjectException.php │ ├── InvalidStyleException.php │ └── UnsupportedImageTypeException.php │ ├── IOFactory.php │ ├── Media.php │ ├── Metadata │ ├── Compatibility.php │ ├── DocInfo.php │ └── Protection.php │ ├── PhpWord.php │ ├── Reader │ ├── AbstractReader.php │ ├── HTML.php │ ├── MsDoc.php │ ├── ODText.php │ ├── ODText │ │ ├── AbstractPart.php │ │ ├── Content.php │ │ └── Meta.php │ ├── RTF.php │ ├── RTF │ │ └── Document.php │ ├── ReaderInterface.php │ ├── Word2007.php │ └── Word2007 │ │ ├── AbstractPart.php │ │ ├── DocPropsApp.php │ │ ├── DocPropsCore.php │ │ ├── DocPropsCustom.php │ │ ├── Document.php │ │ ├── Endnotes.php │ │ ├── Footnotes.php │ │ ├── Numbering.php │ │ └── Styles.php │ ├── Settings.php │ ├── Shared │ ├── Converter.php │ ├── Html.php │ ├── OLERead.php │ ├── PCLZip │ │ └── pclzip.lib.php │ └── ZipArchive.php │ ├── SimpleType │ ├── Jc.php │ └── JcTable.php │ ├── Style.php │ ├── Style │ ├── AbstractStyle.php │ ├── Border.php │ ├── Cell.php │ ├── Chart.php │ ├── Extrusion.php │ ├── Fill.php │ ├── Font.php │ ├── Frame.php │ ├── Image.php │ ├── Indentation.php │ ├── Line.php │ ├── LineNumbering.php │ ├── ListItem.php │ ├── Numbering.php │ ├── NumberingLevel.php │ ├── Outline.php │ ├── Paper.php │ ├── Paragraph.php │ ├── Row.php │ ├── Section.php │ ├── Shading.php │ ├── Shadow.php │ ├── Shape.php │ ├── Spacing.php │ ├── TOC.php │ ├── Tab.php │ ├── Table.php │ └── TextBox.php │ ├── Template.php │ ├── TemplateProcessor.php │ ├── Writer │ ├── AbstractWriter.php │ ├── HTML.php │ ├── HTML │ │ ├── Element │ │ │ ├── AbstractElement.php │ │ │ ├── Container.php │ │ │ ├── Endnote.php │ │ │ ├── Footnote.php │ │ │ ├── Image.php │ │ │ ├── Link.php │ │ │ ├── ListItem.php │ │ │ ├── PageBreak.php │ │ │ ├── Table.php │ │ │ ├── Text.php │ │ │ ├── TextBreak.php │ │ │ ├── TextRun.php │ │ │ └── Title.php │ │ ├── Part │ │ │ ├── AbstractPart.php │ │ │ ├── Body.php │ │ │ └── Head.php │ │ └── Style │ │ │ ├── AbstractStyle.php │ │ │ ├── Font.php │ │ │ ├── Generic.php │ │ │ ├── Image.php │ │ │ └── Paragraph.php │ ├── ODText.php │ ├── ODText │ │ ├── Element │ │ │ ├── AbstractElement.php │ │ │ ├── Container.php │ │ │ ├── Image.php │ │ │ ├── Link.php │ │ │ ├── Table.php │ │ │ ├── Text.php │ │ │ ├── TextBreak.php │ │ │ ├── TextRun.php │ │ │ └── Title.php │ │ ├── Part │ │ │ ├── AbstractPart.php │ │ │ ├── Content.php │ │ │ ├── Manifest.php │ │ │ ├── Meta.php │ │ │ ├── Mimetype.php │ │ │ └── Styles.php │ │ └── Style │ │ │ ├── AbstractStyle.php │ │ │ ├── Font.php │ │ │ ├── Image.php │ │ │ ├── Paragraph.php │ │ │ ├── Section.php │ │ │ └── Table.php │ ├── PDF.php │ ├── PDF │ │ ├── AbstractRenderer.php │ │ ├── DomPDF.php │ │ ├── MPDF.php │ │ └── TCPDF.php │ ├── RTF.php │ ├── RTF │ │ ├── Element │ │ │ ├── AbstractElement.php │ │ │ ├── Container.php │ │ │ ├── Image.php │ │ │ ├── Link.php │ │ │ ├── ListItem.php │ │ │ ├── PageBreak.php │ │ │ ├── Table.php │ │ │ ├── Text.php │ │ │ ├── TextBreak.php │ │ │ ├── TextRun.php │ │ │ └── Title.php │ │ ├── Part │ │ │ ├── AbstractPart.php │ │ │ ├── Document.php │ │ │ └── Header.php │ │ └── Style │ │ │ ├── AbstractStyle.php │ │ │ ├── Border.php │ │ │ ├── Font.php │ │ │ ├── Paragraph.php │ │ │ └── Section.php │ ├── Word2007.php │ ├── Word2007 │ │ ├── Element │ │ │ ├── AbstractElement.php │ │ │ ├── Bookmark.php │ │ │ ├── Chart.php │ │ │ ├── CheckBox.php │ │ │ ├── Container.php │ │ │ ├── Endnote.php │ │ │ ├── Field.php │ │ │ ├── Footnote.php │ │ │ ├── FormField.php │ │ │ ├── Image.php │ │ │ ├── Line.php │ │ │ ├── Link.php │ │ │ ├── ListItem.php │ │ │ ├── ListItemRun.php │ │ │ ├── Object.php │ │ │ ├── PageBreak.php │ │ │ ├── ParagraphAlignment.php │ │ │ ├── PreserveText.php │ │ │ ├── SDT.php │ │ │ ├── Shape.php │ │ │ ├── TOC.php │ │ │ ├── Table.php │ │ │ ├── TableAlignment.php │ │ │ ├── Text.php │ │ │ ├── TextBox.php │ │ │ ├── TextBreak.php │ │ │ ├── TextRun.php │ │ │ └── Title.php │ │ ├── Part │ │ │ ├── AbstractPart.php │ │ │ ├── Chart.php │ │ │ ├── ContentTypes.php │ │ │ ├── DocPropsApp.php │ │ │ ├── DocPropsCore.php │ │ │ ├── DocPropsCustom.php │ │ │ ├── Document.php │ │ │ ├── Endnotes.php │ │ │ ├── FontTable.php │ │ │ ├── Footer.php │ │ │ ├── Footnotes.php │ │ │ ├── Header.php │ │ │ ├── Numbering.php │ │ │ ├── Rels.php │ │ │ ├── RelsDocument.php │ │ │ ├── RelsPart.php │ │ │ ├── Settings.php │ │ │ ├── Styles.php │ │ │ ├── Theme.php │ │ │ └── WebSettings.php │ │ └── Style │ │ │ ├── AbstractStyle.php │ │ │ ├── Cell.php │ │ │ ├── Extrusion.php │ │ │ ├── Fill.php │ │ │ ├── Font.php │ │ │ ├── Frame.php │ │ │ ├── Image.php │ │ │ ├── Indentation.php │ │ │ ├── Line.php │ │ │ ├── LineNumbering.php │ │ │ ├── MarginBorder.php │ │ │ ├── Outline.php │ │ │ ├── Paragraph.php │ │ │ ├── Row.php │ │ │ ├── Section.php │ │ │ ├── Shading.php │ │ │ ├── Shadow.php │ │ │ ├── Shape.php │ │ │ ├── Spacing.php │ │ │ ├── Tab.php │ │ │ ├── Table.php │ │ │ └── TextBox.php │ └── WriterInterface.php │ └── resources │ ├── doc.png │ ├── ppt.png │ └── xls.png └── tests ├── PhpWord ├── Collection │ └── CollectionTest.php ├── Element │ ├── AbstractElementTest.php │ ├── CellTest.php │ ├── CheckBoxTest.php │ ├── FieldTest.php │ ├── FooterTest.php │ ├── FootnoteTest.php │ ├── HeaderTest.php │ ├── ImageTest.php │ ├── LineTest.php │ ├── LinkTest.php │ ├── ListItemRunTest.php │ ├── ListItemTest.php │ ├── ObjectTest.php │ ├── PageBreakTest.php │ ├── PreserveTextTest.php │ ├── RowTest.php │ ├── SDTTest.php │ ├── SectionTest.php │ ├── TOCTest.php │ ├── TableTest.php │ ├── TextBoxTest.php │ ├── TextBreakTest.php │ ├── TextRunTest.php │ ├── TextTest.php │ └── TitleTest.php ├── Exception │ ├── CopyFileExceptionTest.php │ ├── CreateTemporaryFileExceptionTest.php │ ├── ExceptionTest.php │ ├── InvalidImageExceptionTest.php │ ├── InvalidStyleExceptionTest.php │ └── UnsupportedImageTypeExceptionTest.php ├── IOFactoryTest.php ├── MediaTest.php ├── Metadata │ └── DocInfoTest.php ├── PhpWordTest.php ├── Reader │ ├── HTMLTest.php │ ├── ODTextTest.php │ ├── RTFTest.php │ └── Word2007Test.php ├── SettingsTest.php ├── Shared │ ├── ConverterTest.php │ ├── HtmlTest.php │ └── ZipArchiveTest.php ├── Style │ ├── AbstractStyleTest.php │ ├── CellTest.php │ ├── FontTest.php │ ├── ImageTest.php │ ├── IndentationTest.php │ ├── LineNumberingTest.php │ ├── LineTest.php │ ├── ListItemTest.php │ ├── NumberingLevelTest.php │ ├── NumberingTest.php │ ├── ParagraphTest.php │ ├── RowTest.php │ ├── SectionTest.php │ ├── ShadingTest.php │ ├── SpacingTest.php │ ├── TOCTest.php │ ├── TabTest.php │ ├── TableTest.php │ └── TextBoxTest.php ├── StyleTest.php ├── TemplateProcessorTest.php ├── Writer │ ├── HTML │ │ ├── ElementTest.php │ │ ├── PartTest.php │ │ └── StyleTest.php │ ├── HTMLTest.php │ ├── ODText │ │ ├── ElementTest.php │ │ ├── Part │ │ │ ├── AbstractPartTest.php │ │ │ └── ContentTest.php │ │ └── StyleTest.php │ ├── ODTextTest.php │ ├── PDF │ │ ├── DomPDFTest.php │ │ ├── MPDFTest.php │ │ └── TCPDFTest.php │ ├── PDFTest.php │ ├── RTF │ │ ├── ElementTest.php │ │ └── StyleTest.php │ ├── RTFTest.php │ ├── Word2007 │ │ ├── ElementTest.php │ │ ├── Part │ │ │ ├── AbstractPartTest.php │ │ │ ├── DocumentTest.php │ │ │ ├── FooterTest.php │ │ │ ├── FootnotesTest.php │ │ │ ├── HeaderTest.php │ │ │ ├── NumberingTest.php │ │ │ ├── SettingsTest.php │ │ │ └── StylesTest.php │ │ ├── PartTest.php │ │ ├── Style │ │ │ └── FontTest.php │ │ └── StyleTest.php │ └── Word2007Test.php ├── _files │ ├── documents │ │ ├── reader.docx │ │ ├── reader.docx.zip │ │ ├── reader.html │ │ ├── reader.odt │ │ ├── reader.rtf │ │ ├── sheet.xls │ │ └── without_table_macros.docx │ ├── images │ │ ├── PhpWord.png │ │ ├── alexz-johnson.pcx │ │ ├── angela_merkel.tif │ │ ├── duke_nukem.bmp │ │ ├── earth.jpg │ │ ├── firefox.png │ │ ├── mario.gif │ │ ├── mars.jpg │ │ └── mars_noext_jpg │ ├── templates │ │ ├── blank.docx │ │ ├── clone-delete-block.docx │ │ ├── clone-merge.docx │ │ ├── corrupted_main_document_part.docx │ │ ├── header-footer.docx │ │ └── with_table_macros.docx │ └── xsl │ │ ├── passthrough.xsl │ │ └── remove_tables_by_needle.xsl └── _includes │ ├── TestHelperDOCX.php │ └── XmlDocument.php └── bootstrap.php /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | ._* 3 | .Spotlight-V100 4 | .Trashes 5 | Thumbs.db 6 | Desktop.ini 7 | .idea 8 | _build 9 | phpunit.xml 10 | composer.lock 11 | composer.phar 12 | vendor 13 | /report 14 | /samples/resources 15 | /samples/results 16 | /.settings 17 | phpword.ini 18 | /.buildpath 19 | /.project -------------------------------------------------------------------------------- /.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | filter: 2 | excluded_paths: [ 'vendor/*', 'tests/*', 'samples/*', 'src/PhpWord/Shared/PCLZip/*' ] 3 | 4 | before_commands: 5 | - "composer install --prefer-source --dev" 6 | 7 | tools: 8 | php_code_sniffer: 9 | enabled: true 10 | config: 11 | standard: PSR2 12 | php_mess_detector: 13 | enabled: true 14 | config: 15 | ruleset: phpmd.xml.dist 16 | external_code_coverage: 17 | enabled: true 18 | timeout: 900 19 | php_cpd: true 20 | # php_sim: # Temporarily disabled to allow focus on things other than duplicates 21 | # min_mass: 40 22 | php_pdepend: true 23 | php_analyzer: true 24 | sensiolabs_security_checker: true 25 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 5.3 5 | - 5.4 6 | - 5.5 7 | - 5.6 8 | - 7.0 9 | - hhvm 10 | 11 | matrix: 12 | allow_failures: 13 | - php: 7.0 14 | - php: hhvm 15 | 16 | env: 17 | global: 18 | - secure: "Sq+6bVtnPsu0mWX8DWQ+9bGAjxMcGorksUiHc4YIXEJsuDfVmVlH8tTD547IeCjDAx9MxXerZ2Z4HSjxTB70VEnJPvZMHI/EZn4Ny31YLHEthdZbV5Gd1h0TGp8VOzPKGShvGrtGBX6MvMfgpK4zuieVWbSfdKeecm8ZNLMpUd4=" 19 | 20 | before_install: 21 | ## Packages 22 | - sudo apt-get update -qq 23 | - sudo apt-get install -y graphviz 24 | 25 | before_script: 26 | ## Composer 27 | - composer self-update 28 | - composer install --prefer-source 29 | ## PHPDocumentor 30 | - mkdir -p build/docs 31 | - mkdir -p build/coverage 32 | 33 | script: 34 | ## PHP_CodeSniffer 35 | - ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip 36 | ## PHP Mess Detector 37 | - ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php 38 | ## PHPUnit 39 | - ./vendor/bin/phpunit -c ./ --coverage-text --coverage-html ./build/coverage 40 | ## PHPLOC 41 | - ./vendor/bin/phploc src/ 42 | ## PHPDocumentor 43 | - ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig" 44 | 45 | after_script: 46 | ## PHPDocumentor 47 | - bash .travis_shell_after_success.sh 48 | ## Scrutinizer 49 | - wget https://scrutinizer-ci.com/ocular.phar 50 | - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml 51 | -------------------------------------------------------------------------------- /.travis_shell_after_success.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "--DEBUG--" 4 | echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG" 5 | echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION" 6 | echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST" 7 | 8 | if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.5" ]; then 9 | 10 | echo -e "Publishing PHPDoc...\n" 11 | 12 | cp -R build/docs $HOME/docs-latest 13 | cp -R build/coverage $HOME/coverage-latest 14 | 15 | cd $HOME 16 | git config --global user.email "travis@travis-ci.org" 17 | git config --global user.name "travis-ci" 18 | git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/PHPOffice/PHPWord gh-pages > /dev/null 19 | 20 | cd gh-pages 21 | echo "--DEBUG : Suppression" 22 | git rm -rf ./docs/$TRAVIS_BRANCH 23 | 24 | echo "--DEBUG : Dossier" 25 | mkdir -p docs/$TRAVIS_BRANCH 26 | mkdir -p coverage/$TRAVIS_BRANCH 27 | 28 | echo "--DEBUG : Copie" 29 | cp -Rf $HOME/docs-latest/* ./docs/$TRAVIS_BRANCH/ 30 | cp -Rf $HOME/coverage-latest/* ./coverage/$TRAVIS_BRANCH/ 31 | 32 | echo "--DEBUG : Git" 33 | git add -f . 34 | git commit -m "PHPDocumentor (Travis Build: $TRAVIS_BUILD_NUMBER - Branch: $TRAVIS_BRANCH)" 35 | git push -fq origin gh-pages > /dev/null 36 | 37 | echo -e "Published PHPDoc to gh-pages.\n" 38 | 39 | fi 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | PHPWord, a pure PHP library for reading and writing word processing documents. 2 | 3 | Copyright (c) 2010-2016 PHPWord. 4 | 5 | PHPWord is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License version 3 as published by 7 | the Free Software Foundation. 8 | 9 | PHPWord is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License version 3 for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License version 3 15 | along with PHPWord. If not, see . 16 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.13.0 -------------------------------------------------------------------------------- /bootstrap.php: -------------------------------------------------------------------------------- 1 | `__) 9 | 10 | Is this the same with PHPWord that I found in CodePlex? 11 | ------------------------------------------------------- 12 | 13 | No. This one is much better with tons of new features that you can’t 14 | find in PHPWord 0.6.3. The development in CodePlex is halted and 15 | switched to GitHub to allow more participation from the crowd. The more 16 | the merrier, right? 17 | 18 | I’ve been running PHPWord from CodePlex flawlessly, but I can’t use the latest PHPWord from GitHub. Why? 19 | -------------------------------------------------------------------------------------------------------- 20 | 21 | PHPWord requires PHP 5.3+ since 0.8, while PHPWord 0.6.3 from CodePlex 22 | can run with PHP 5.2. There’s a lot of new features that we can get from 23 | PHP 5.3 and it’s been around since 2009! You should upgrade your PHP 24 | version to use PHPWord 0.8+. 25 | -------------------------------------------------------------------------------- /docs/images/phpword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/docs/images/phpword.png -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. PHPWord documentation master file, created by 2 | sphinx-quickstart on Fri Mar 14 23:09:26 2014. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to PHPWord's documentation 7 | ================================== 8 | 9 | |PHPWord| 10 | 11 | PHPWord is a library written in pure PHP that provides a set of classes to 12 | write to and read from different document file formats. The current version of 13 | PHPWord supports Microsoft Office Open XML (OOXML or OpenXML), OASIS Open 14 | Document Format for Office Applications (OpenDocument or ODF), and Rich Text 15 | Format (RTF). 16 | 17 | .. toctree:: 18 | :maxdepth: 2 19 | 20 | intro 21 | installing 22 | general 23 | containers 24 | elements 25 | styles 26 | templates-processing 27 | writersreaders 28 | recipes 29 | faq 30 | credits 31 | references 32 | 33 | Indices and tables 34 | ================== 35 | 36 | * :ref:`genindex` 37 | * :ref:`modindex` 38 | * :ref:`search` 39 | 40 | .. |PHPWord| image:: images/phpword.png 41 | -------------------------------------------------------------------------------- /docs/references.rst: -------------------------------------------------------------------------------- 1 | .. _references: 2 | 3 | References 4 | ========== 5 | 6 | ISO/IEC 29500, Third edition, 2012-09-01 7 | --------------------- 8 | 9 | - `Part 1: Fundamentals and Markup Language Reference 10 | `__ 11 | - `Part 2: Open Packaging Conventions 12 | `__ 13 | - `Part 3: Markup Compatibility and Extensibility 14 | `__ 15 | - `Part 4: Transitional Migration Features 16 | `__ 17 | 18 | Formal specifications 19 | --------------------- 20 | 21 | - `Oasis OpenDocument Standard Version 1.2 `__ 22 | - `Rich Text Format (RTF) Specification, version 1.9.1 `__ 23 | 24 | Other resources 25 | --------------- 26 | 27 | - `DocumentFormat.OpenXml.Wordprocessing Namespace on 28 | MSDN `__ 29 | -------------------------------------------------------------------------------- /docs/templates-processing.rst: -------------------------------------------------------------------------------- 1 | .. _templates-processing: 2 | 3 | Templates processing 4 | ==================== 5 | 6 | You can create an OOXML document template with included search-patterns (macros) which can be replaced by any value you wish. Only single-line values can be replaced. 7 | 8 | To deal with a template file, use ``new TemplateProcessor`` statement. After TemplateProcessor instance creation the document template is copied into the temporary directory. Then you can use ``TemplateProcessor::setValue`` method to change the value of a search pattern. The search-pattern model is: ``${search-pattern}``. 9 | 10 | Example: 11 | 12 | .. code-block:: php 13 | 14 | $templateProcessor = new TemplateProcessor('Template.docx'); 15 | $templateProcessor->setValue('Name', 'John Doe'); 16 | $templateProcessor->setValue(array('City', 'Street'), array('Detroit', '12th Street')); 17 | 18 | It is not possible to directly add new OOXML elements to the template file being processed, but it is possible to transform headers, main document part, and footers of the template using XSLT (see ``TemplateProcessor::applyXslStyleSheet``). 19 | 20 | See ``Sample_07_TemplateCloneRow.php`` for example on how to create 21 | multirow from a single row in a template by using ``TemplateProcessor::cloneRow``. 22 | 23 | See ``Sample_23_TemplateBlock.php`` for example on how to clone a block 24 | of text using ``TemplateProcessor::cloneBlock`` and delete a block of text using 25 | ``TemplateProcessor::deleteBlock``. 26 | -------------------------------------------------------------------------------- /phpmd.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | ./tests/PhpWord 14 | 15 | 16 | 17 | 18 | ./src 19 | 20 | ./src/PhpWord/Shared/PCLZip 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /phpword.ini.dist: -------------------------------------------------------------------------------- 1 | ; Default config file for PHPWord 2 | ; Copy this file into phpword.ini and use Settings::loadConfig to load 3 | 4 | [General] 5 | 6 | compatibility = true 7 | zipClass = ZipArchive 8 | pdfRendererName = DomPDF 9 | pdfRendererPath = 10 | ; tempDir = "C:\PhpWordTemp" 11 | outputEscapingEnabled = false 12 | 13 | [Font] 14 | 15 | defaultFontName = Arial 16 | defaultFontSize = 10 17 | -------------------------------------------------------------------------------- /samples/Sample_02_TabStops.php: -------------------------------------------------------------------------------- 1 | addParagraphStyle( 11 | $multipleTabsStyleName, 12 | array( 13 | 'tabs' => array( 14 | new \PhpOffice\PhpWord\Style\Tab('left', 1550), 15 | new \PhpOffice\PhpWord\Style\Tab('center', 3200), 16 | new \PhpOffice\PhpWord\Style\Tab('right', 5300), 17 | ) 18 | ) 19 | ); 20 | 21 | $rightTabStyleName = 'rightTab'; 22 | $phpWord->addParagraphStyle($rightTabStyleName, array('tabs' => array(new \PhpOffice\PhpWord\Style\Tab('right', 9090)))); 23 | 24 | $leftTabStyleName = 'centerTab'; 25 | $phpWord->addParagraphStyle($leftTabStyleName, array('tabs' => array(new \PhpOffice\PhpWord\Style\Tab('center', 4680)))); 26 | 27 | // New portrait section 28 | $section = $phpWord->addSection(); 29 | 30 | // Add listitem elements 31 | $section->addText("Multiple Tabs:\tOne\tTwo\tThree", null, $multipleTabsStyleName); 32 | $section->addText("Left Aligned\tRight Aligned", null, $rightTabStyleName); 33 | $section->addText("\tCenter Aligned", null, $leftTabStyleName); 34 | 35 | // Save file 36 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 37 | if (!CLI) { 38 | include_once 'Sample_Footer.php'; 39 | } 40 | -------------------------------------------------------------------------------- /samples/Sample_03_Sections.php: -------------------------------------------------------------------------------- 1 | addSection(array('borderColor' => '00FF00', 'borderSize' => 12)); 10 | $section->addText('I am placed on a default section.'); 11 | 12 | // New landscape section 13 | $section = $phpWord->addSection(array('orientation' => 'landscape')); 14 | $section->addText('I am placed on a landscape section. Every page starting from this section will be landscape style.'); 15 | $section->addPageBreak(); 16 | $section->addPageBreak(); 17 | 18 | // New portrait section 19 | $section = $phpWord->addSection( 20 | array('paperSize' => 'Folio', 'marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600) 21 | ); 22 | $section->addText('This section uses other margins with folio papersize.'); 23 | 24 | // New portrait section with Header & Footer 25 | $section = $phpWord->addSection( 26 | array( 27 | 'marginLeft' => 200, 28 | 'marginRight' => 200, 29 | 'marginTop' => 200, 30 | 'marginBottom' => 200, 31 | 'headerHeight' => 50, 32 | 'footerHeight' => 50, 33 | ) 34 | ); 35 | $section->addText('This section and we play with header/footer height.'); 36 | $section->addHeader()->addText('Header'); 37 | $section->addFooter()->addText('Footer'); 38 | 39 | // Save file 40 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 41 | if (!CLI) { 42 | include_once 'Sample_Footer.php'; 43 | } 44 | -------------------------------------------------------------------------------- /samples/Sample_05_Multicolumn.php: -------------------------------------------------------------------------------- 1 | addSection(); 14 | $section->addText("Normal paragraph. {$filler}"); 15 | 16 | // Two columns 17 | $section = $phpWord->addSection( 18 | array( 19 | 'colsNum' => 2, 20 | 'colsSpace' => 1440, 21 | 'breakType' => 'continuous', 22 | ) 23 | ); 24 | $section->addText("Two columns, one inch (1440 twips) spacing. {$filler}"); 25 | 26 | // Normal 27 | $section = $phpWord->addSection(array('breakType' => 'continuous')); 28 | $section->addText("Normal paragraph again. {$filler}"); 29 | 30 | // Three columns 31 | $section = $phpWord->addSection( 32 | array( 33 | 'colsNum' => 3, 34 | 'colsSpace' => 720, 35 | 'breakType' => 'continuous', 36 | ) 37 | ); 38 | $section->addText("Three columns, half inch (720 twips) spacing. {$filler}"); 39 | 40 | // Normal 41 | $section = $phpWord->addSection(array('breakType' => 'continuous')); 42 | $section->addText("Normal paragraph again. {$filler}"); 43 | 44 | // Save file 45 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 46 | if (!CLI) { 47 | include_once 'Sample_Footer.php'; 48 | } 49 | -------------------------------------------------------------------------------- /samples/Sample_10_EastAsianFontStyle.php: -------------------------------------------------------------------------------- 1 | addSection(); 8 | $header = array('size' => 16, 'bold' => true); 9 | //1.Use EastAisa FontStyle 10 | $section->addText('中文楷体样式测试', array('name' => '楷体', 'size' => 16, 'color' => '1B2232')); 11 | 12 | // Save file 13 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 14 | if (!CLI) { 15 | include_once 'Sample_Footer.php'; 16 | } 17 | -------------------------------------------------------------------------------- /samples/Sample_11_ReadWord2007.php: -------------------------------------------------------------------------------- 1 | 'docx', 'ODText' => 'odt', 'RTF' => 'rtf'); 12 | foreach ($writers as $writer => $extension) { 13 | echo date('H:i:s'), " Write to {$writer} format", EOL; 14 | $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer); 15 | $xmlWriter->save("{$name}.{$extension}"); 16 | rename("{$name}.{$extension}", "results/{$name}.{$extension}"); 17 | } 18 | 19 | include_once 'Sample_Footer.php'; 20 | -------------------------------------------------------------------------------- /samples/Sample_15_Link.php: -------------------------------------------------------------------------------- 1 | addLinkStyle($linkFontStyleName, array('bold' => true, 'color' => '808000')); 11 | 12 | // New section 13 | $section = $phpWord->addSection(); 14 | 15 | // Add hyperlink elements 16 | $section->addLink( 17 | 'https://github.com/PHPOffice/PHPWord', 18 | 'PHPWord on GitHub', 19 | array('color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE) 20 | ); 21 | $section->addTextBreak(2); 22 | $section->addLink('http://www.bing.com', null, $linkFontStyleName); 23 | $section->addLink('http://www.yahoo.com', null, $linkFontStyleName); 24 | 25 | // Save file 26 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 27 | if (!CLI) { 28 | include_once 'Sample_Footer.php'; 29 | } 30 | -------------------------------------------------------------------------------- /samples/Sample_16_Object.php: -------------------------------------------------------------------------------- 1 | addSection(); 10 | $section->addText('You can open this OLE object by double clicking on the icon:'); 11 | $section->addTextBreak(2); 12 | $section->addObject('resources/_sheet.xls'); 13 | 14 | // Save file 15 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 16 | if (!CLI) { 17 | include_once 'Sample_Footer.php'; 18 | } 19 | -------------------------------------------------------------------------------- /samples/Sample_18_Watermark.php: -------------------------------------------------------------------------------- 1 | addSection(); 10 | $header = $section->addHeader(); 11 | $header->addWatermark('resources/_earth.jpg', array('marginTop' => 200, 'marginLeft' => 55)); 12 | $section->addText('The header reference to the current section includes a watermark image.'); 13 | 14 | // Save file 15 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 16 | if (!CLI) { 17 | include_once 'Sample_Footer.php'; 18 | } 19 | -------------------------------------------------------------------------------- /samples/Sample_19_TextBreak.php: -------------------------------------------------------------------------------- 1 | 24); 10 | 11 | $paragraphStyle24 = array('spacing' => 240, 'size' => 24); 12 | 13 | $fontStyleName = 'fontStyle'; 14 | $phpWord->addFontStyle($fontStyleName, array('size' => 9)); 15 | 16 | $paragraphStyleName = 'paragraphStyle'; 17 | $phpWord->addParagraphStyle($paragraphStyleName, array('spacing' => 480)); 18 | 19 | // New section 20 | $section = $phpWord->addSection(); 21 | 22 | $section->addText('Text break with no style:'); 23 | $section->addTextBreak(); 24 | $section->addText('Text break with defined font style:'); 25 | $section->addTextBreak(1, $fontStyleName); 26 | $section->addText('Text break with defined paragraph style:'); 27 | $section->addTextBreak(1, null, $paragraphStyleName); 28 | $section->addText('Text break with inline font style:'); 29 | $section->addTextBreak(1, $fontStyle24); 30 | $section->addText('Text break with inline paragraph style:'); 31 | $section->addTextBreak(1, null, $paragraphStyle24); 32 | $section->addText('Done.'); 33 | 34 | // Save file 35 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 36 | if (!CLI) { 37 | include_once 'Sample_Footer.php'; 38 | } 39 | -------------------------------------------------------------------------------- /samples/Sample_20_BGColor.php: -------------------------------------------------------------------------------- 1 | addSection(); 10 | 11 | $section->addText( 12 | 'This is some text highlighted using fgColor (limited to 15 colors)', 13 | array('fgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW) 14 | ); 15 | $section->addText('This one uses bgColor and is using hex value (0xfbbb10)', array('bgColor' => 'fbbb10')); 16 | $section->addText('Compatible with font colors', array('color' => '0000ff', 'bgColor' => 'fbbb10')); 17 | 18 | // Save file 19 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 20 | if (!CLI) { 21 | include_once 'Sample_Footer.php'; 22 | } 23 | -------------------------------------------------------------------------------- /samples/Sample_22_CheckBox.php: -------------------------------------------------------------------------------- 1 | addSection(); 10 | 11 | $section->addText('Check box in section'); 12 | $section->addCheckBox('chkBox1', 'Checkbox 1'); 13 | $section->addText('Check box in table cell'); 14 | $table = $section->addTable(); 15 | $table->addRow(); 16 | $cell = $table->addCell(); 17 | $cell->addCheckBox('chkBox2', 'Checkbox 2'); 18 | 19 | // Save file 20 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 21 | if (!CLI) { 22 | include_once 'Sample_Footer.php'; 23 | } 24 | -------------------------------------------------------------------------------- /samples/Sample_23_TemplateBlock.php: -------------------------------------------------------------------------------- 1 | cloneBlock('CLONEME', 3); 10 | 11 | // Everything between ${tag} and ${/tag}, will be deleted/erased. 12 | $templateProcessor->deleteBlock('DELETEME'); 13 | 14 | echo date('H:i:s'), ' Saving the result document...', EOL; 15 | $templateProcessor->saveAs('results/Sample_23_TemplateBlock.docx'); 16 | 17 | echo getEndingNotes(array('Word2007' => 'docx')); 18 | if (!CLI) { 19 | include_once 'Sample_Footer.php'; 20 | } 21 | -------------------------------------------------------------------------------- /samples/Sample_24_ReadODText.php: -------------------------------------------------------------------------------- 1 | addSection(); 10 | 11 | // In section 12 | $textbox = $section->addTextBox( 13 | array( 14 | 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER, 15 | 'width' => 400, 16 | 'height' => 150, 17 | 'borderSize' => 1, 18 | 'borderColor' => '#FF0000', 19 | ) 20 | ); 21 | $textbox->addText('Text box content in section.'); 22 | $textbox->addText('Another line.'); 23 | $cell = $textbox->addTable()->addRow()->addCell(); 24 | $cell->addText('Table inside textbox'); 25 | 26 | // Inside table 27 | $section->addTextBreak(2); 28 | $cell = $section->addTable()->addRow()->addCell(300); 29 | $textbox = $cell->addTextBox(array('borderSize' => 1, 'borderColor' => '#0000FF', 'innerMargin' => 100)); 30 | $textbox->addText('Textbox inside table'); 31 | 32 | // Inside header with textrun 33 | $header = $section->addHeader(); 34 | $textbox = $header->addTextBox(array('width' => 600, 'borderSize' => 1, 'borderColor' => '#00FF00')); 35 | $textrun = $textbox->addTextRun(); 36 | $textrun->addText('TextBox in header. TextBox can contain a TextRun '); 37 | $textrun->addText('with bold text', array('bold' => true)); 38 | $textrun->addText(', '); 39 | $textrun->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub'); 40 | $textrun->addText(', and image '); 41 | $textrun->addImage('resources/_earth.jpg', array('width' => 18, 'height' => 18)); 42 | $textrun->addText('.'); 43 | 44 | // Save file 45 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 46 | if (!CLI) { 47 | include_once 'Sample_Footer.php'; 48 | } 49 | -------------------------------------------------------------------------------- /samples/Sample_26_Html.php: -------------------------------------------------------------------------------- 1 | addSection(); 9 | $html = '

Adding element via HTML

'; 10 | $html .= '

Some well formed HTML snippet needs to be used

'; 11 | $html .= '

With for example some1 inline formatting1

'; 12 | $html .= '

Unordered (bulleted) list:

'; 13 | $html .= '
  • Item 1
  • Item 2
    • Item 2.1
    • Item 2.1
'; 14 | $html .= '

Ordered (numbered) list:

'; 15 | $html .= '
  1. Item 1
  2. Item 2
'; 16 | 17 | \PhpOffice\PhpWord\Shared\Html::addHtml($section, $html); 18 | 19 | // Save file 20 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 21 | if (!CLI) { 22 | include_once 'Sample_Footer.php'; 23 | } 24 | -------------------------------------------------------------------------------- /samples/Sample_27_Field.php: -------------------------------------------------------------------------------- 1 | addSection(); 10 | 11 | // Add Field elements 12 | // See Element/Field.php for all options 13 | $section->addText('Date field:'); 14 | $section->addField('DATE', array('dateformat' => 'dddd d MMMM yyyy H:mm:ss'), array('PreserveFormat')); 15 | 16 | $section->addText('Page field:'); 17 | $section->addField('PAGE', array('format' => 'ArabicDash')); 18 | 19 | $section->addText('Number of pages field:'); 20 | $section->addField('NUMPAGES', array('format' => 'Arabic', 'numformat' => '0,00'), array('PreserveFormat')); 21 | 22 | $textrun = $section->addTextRun(array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER)); 23 | $textrun->addText('This is the date of lunar calendar '); 24 | $textrun->addField('DATE', array('dateformat' => 'd-M-yyyy H:mm:ss'), array('PreserveFormat', 'LunarCalendar')); 25 | $textrun->addText(' written in a textrun.'); 26 | 27 | // Save file 28 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 29 | if (!CLI) { 30 | include_once 'Sample_Footer.php'; 31 | } 32 | -------------------------------------------------------------------------------- /samples/Sample_28_ReadRTF.php: -------------------------------------------------------------------------------- 1 | getProtection()->setEditing('forms'); 8 | 9 | // New section 10 | $section = $phpWord->addSection(); 11 | 12 | $textrun = $section->addTextRun(); 13 | $textrun->addText('Form fields can be added in a text run and can be in form of textinput '); 14 | $textrun->addFormField('textinput')->setName('MyTextBox'); 15 | $textrun->addText(', checkbox '); 16 | $textrun->addFormField('checkbox')->setDefault(true); 17 | $textrun->addText(', or dropdown '); 18 | $textrun->addFormField('dropdown')->setEntries(array('Choice 1', 'Choice 2', 'Choice 3')); 19 | $textrun->addText('. You have to set document protection to "forms" to enable dropdown.'); 20 | 21 | $section->addText('They can also be added as a stand alone paragraph.'); 22 | $section->addFormField('textinput')->setValue('Your name'); 23 | 24 | // Save file 25 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 26 | if (!CLI) { 27 | include_once 'Sample_Footer.php'; 28 | } 29 | -------------------------------------------------------------------------------- /samples/Sample_34_SDT.php: -------------------------------------------------------------------------------- 1 | addSection(); 10 | 11 | $textrun = $section->addTextRun(); 12 | $textrun->addText('Combobox: '); 13 | $textrun->addSDT('comboBox')->setListItems(array('1' => 'Choice 1', '2' => 'Choice 2')); 14 | 15 | $textrun = $section->addTextRun(); 16 | $textrun->addText('Date: '); 17 | $textrun->addSDT('date'); 18 | 19 | $textrun = $section->addTextRun(); 20 | $textrun->addText('Drop down list: '); 21 | $textrun->addSDT('dropDownList')->setListItems(array('1' => 'Choice 1', '2' => 'Choice 2')); 22 | 23 | // Save file 24 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 25 | if (!CLI) { 26 | include_once 'Sample_Footer.php'; 27 | } 28 | -------------------------------------------------------------------------------- /samples/Sample_35_InternalLink.php: -------------------------------------------------------------------------------- 1 | addSection(); 9 | $section->addTitle('This is page 1', 1); 10 | $linkIsInternal = true; 11 | $section->addLink('MyBookmark', 'Take me to page 3', null, null, $linkIsInternal); 12 | $section->addPageBreak(); 13 | $section->addTitle('This is page 2', 1); 14 | $section->addPageBreak(); 15 | $section->addTitle('This is page 3', 1); 16 | $section->addBookmark('MyBookmark'); 17 | 18 | // Save file 19 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 20 | if (!CLI) { 21 | include_once 'Sample_Footer.php'; 22 | } 23 | -------------------------------------------------------------------------------- /samples/Sample_36_RTL.php: -------------------------------------------------------------------------------- 1 | addSection(); 10 | 11 | $textrun = $section->addTextRun(); 12 | $textrun->addText('This is a Left to Right paragraph.'); 13 | 14 | $textrun = $section->addTextRun(array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END)); 15 | $textrun->addText('سلام این یک پاراگراف راست به چپ است', array('rtl' => true)); 16 | 17 | // Save file 18 | echo write($phpWord, basename(__FILE__, '.php'), $writers); 19 | if (!CLI) { 20 | include_once 'Sample_Footer.php'; 21 | } 22 | -------------------------------------------------------------------------------- /samples/Sample_Footer.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /samples/bootstrap/css/phpword.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 20px; 3 | padding-bottom: 20px; 4 | min-height: 1000px; 5 | } 6 | .navbar { 7 | margin-bottom: 20px; 8 | } 9 | .passed { 10 | color: #339900; 11 | } 12 | .failed { 13 | color: #ff0000; 14 | } 15 | -------------------------------------------------------------------------------- /samples/bootstrap/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/samples/bootstrap/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /samples/bootstrap/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/samples/bootstrap/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /samples/bootstrap/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/samples/bootstrap/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /samples/bootstrap/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/samples/bootstrap/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /samples/resources/PhpWord.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/samples/resources/PhpWord.png -------------------------------------------------------------------------------- /samples/resources/Sample_07_TemplateCloneRow.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/samples/resources/Sample_07_TemplateCloneRow.docx -------------------------------------------------------------------------------- /samples/resources/Sample_11_ReadWord2007.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/samples/resources/Sample_11_ReadWord2007.docx -------------------------------------------------------------------------------- /samples/resources/Sample_11_ReadWord97.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/samples/resources/Sample_11_ReadWord97.doc -------------------------------------------------------------------------------- /samples/resources/Sample_23_TemplateBlock.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/samples/resources/Sample_23_TemplateBlock.docx -------------------------------------------------------------------------------- /samples/resources/Sample_24_ReadODText.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/samples/resources/Sample_24_ReadODText.odt -------------------------------------------------------------------------------- /samples/resources/Sample_28_ReadRTF.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1 2 | \ansi\ansicpg1252 3 | \deff0 4 | {\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset0 Times New Roman;}} 5 | {\colortbl;\red255\green0\blue0;\red14\green0\blue0} 6 | {\*\generator PhpWord;} 7 | 8 | {\info{\title }{\subject }{\category }{\keywords }{\comment }{\author }{\operator }{\creatim \yr2014\mo05\dy27\hr23\min36\sec45}{\revtim \yr2014\mo05\dy27\hr23\min36\sec45}{\company }{\manager }} 9 | \deftab720\viewkind1\uc1\pard\nowidctlpar\lang1036\kerning1\fs20 10 | {Welcome to PhpWord}\par 11 | \pard\nowidctlpar{\cf0\f0 Hello World!}\par 12 | \par 13 | \par 14 | \pard\nowidctlpar{\cf0\f0\fs32\b\i I am styled by a font style definition.}\par 15 | \pard\nowidctlpar{\cf0\f0 I am styled by a paragraph style definition.}\par 16 | \pard\nowidctlpar\qc\sa100{\cf0\f0\fs32\b\i I am styled by both font and paragraph style.}\par 17 | \pard\nowidctlpar{\cf1\f1\fs40\b\i\ul\strike\super I am inline styled.}\par 18 | \par 19 | {\field {\*\fldinst {HYPERLINK "https://github.com/PHPOffice/PHPWord"}}{\fldrslt {PHPWord on GitHub}}}\par 20 | \par 21 | } -------------------------------------------------------------------------------- /samples/resources/Sample_30_ReadHTML.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PHPWord 5 | 6 | 7 |

Adding element via HTML

8 |

Some well formed HTML snippet needs to be used

9 |

With for example some1 inline formatting1

10 |

Unordered (bulleted) list:

11 |
  • Item 1
  • Item 2
    • Item 2.1
    • Item 2.1
12 |

Ordered (numbered) list:

13 |
  1. Item 1
  2. Item 2
14 | 15 | 16 | -------------------------------------------------------------------------------- /samples/resources/_earth.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/samples/resources/_earth.jpg -------------------------------------------------------------------------------- /samples/resources/_mars.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/samples/resources/_mars.jpg -------------------------------------------------------------------------------- /samples/resources/_sheet.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/samples/resources/_sheet.xls -------------------------------------------------------------------------------- /samples/results/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /src/PhpWord/Collection/Bookmarks.php: -------------------------------------------------------------------------------- 1 | name = CommonText::toUTF8($name); 50 | return $this; 51 | } 52 | 53 | /** 54 | * Get Bookmark name 55 | * 56 | * @return string 57 | */ 58 | public function getName() 59 | { 60 | return $this->name; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/PhpWord/Element/Endnote.php: -------------------------------------------------------------------------------- 1 | paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/PhpWord/Element/Header.php: -------------------------------------------------------------------------------- 1 | addImage($src, $style, true); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/PhpWord/Element/Line.php: -------------------------------------------------------------------------------- 1 | style = $this->setNewStyle(new LineStyle(), $style); 42 | } 43 | 44 | /** 45 | * Get line style 46 | * 47 | * @return \PhpOffice\PhpWord\Style\Line 48 | */ 49 | public function getStyle() 50 | { 51 | return $this->style; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/PhpWord/Element/PageBreak.php: -------------------------------------------------------------------------------- 1 | style = $this->setNewStyle(new TextBoxStyle(), $style); 49 | } 50 | 51 | /** 52 | * Get textbox style 53 | * 54 | * @return \PhpOffice\PhpWord\Style\TextBox 55 | */ 56 | public function getStyle() 57 | { 58 | return $this->style; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/PhpWord/Element/TextRun.php: -------------------------------------------------------------------------------- 1 | paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle); 47 | } 48 | 49 | /** 50 | * Get Paragraph style 51 | * 52 | * @return string|\PhpOffice\PhpWord\Style\Paragraph 53 | */ 54 | public function getParagraphStyle() 55 | { 56 | return $this->paragraphStyle; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/PhpWord/Escaper/AbstractEscaper.php: -------------------------------------------------------------------------------- 1 | escapeSingleValue($item); 39 | } 40 | } else { 41 | $input = $this->escapeSingleValue($input); 42 | } 43 | 44 | return $input; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/PhpWord/Escaper/EscaperInterface.php: -------------------------------------------------------------------------------- 1 | ooxmlVersion; 48 | } 49 | 50 | /** 51 | * Set OOXML version 52 | * 53 | * @param int $value 54 | * @return self 55 | */ 56 | public function setOoxmlVersion($value) 57 | { 58 | $this->ooxmlVersion = $value; 59 | 60 | return $this; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/PhpWord/Reader/HTML.php: -------------------------------------------------------------------------------- 1 | canRead($docFile)) { 44 | $section = $phpWord->addSection(); 45 | HTMLParser::addHtml($section, file_get_contents($docFile), true); 46 | } else { 47 | throw new \Exception("Cannot read {$docFile}."); 48 | } 49 | 50 | return $phpWord; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/PhpWord/Reader/ODText/AbstractPart.php: -------------------------------------------------------------------------------- 1 | canRead($docFile)) { 44 | $doc = new Document(); 45 | $doc->rtf = file_get_contents($docFile); 46 | $doc->read($phpWord); 47 | } else { 48 | throw new \Exception("Cannot read {$docFile}."); 49 | } 50 | 51 | return $phpWord; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/PhpWord/Reader/ReaderInterface.php: -------------------------------------------------------------------------------- 1 | 'setCompany', 'Manager' => 'setManager'); 33 | 34 | /** 35 | * Callback functions 36 | * 37 | * @var array 38 | */ 39 | protected $callbacks = array(); 40 | } 41 | -------------------------------------------------------------------------------- /src/PhpWord/Reader/Word2007/Endnotes.php: -------------------------------------------------------------------------------- 1 | array(self::START, self::CENTER, self::END), 48 | 'strict' => InArray::COMPARE_STRICT, 49 | ) 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/PhpWord/Style/Fill.php: -------------------------------------------------------------------------------- 1 | setStyleByArray($style); 45 | } 46 | 47 | /** 48 | * Get color 49 | * 50 | * @return string 51 | */ 52 | public function getColor() 53 | { 54 | return $this->color; 55 | } 56 | 57 | /** 58 | * Set color 59 | * 60 | * @param string $value 61 | * @return self 62 | */ 63 | public function setColor($value = null) 64 | { 65 | $this->color = $value; 66 | 67 | return $this; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/PhpWord/Template.php: -------------------------------------------------------------------------------- 1 | element instanceof \PhpOffice\PhpWord\Element\Footnote) { 42 | return ''; 43 | } 44 | /** @var \PhpOffice\PhpWord\Writer\HTML $parentWriter Type hint */ 45 | $parentWriter = $this->parentWriter; 46 | 47 | $noteId = count($parentWriter->getNotes()) + 1; 48 | $noteMark = $this->noteType . '-' . $this->element->getRelationId(); 49 | $content = "{$noteId}"; 50 | 51 | $parentWriter->addNote($noteId, $noteMark); 52 | 53 | return $content; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/HTML/Element/Link.php: -------------------------------------------------------------------------------- 1 | element instanceof \PhpOffice\PhpWord\Element\Link) { 37 | return ''; 38 | } 39 | 40 | $content = ''; 41 | $content .= $this->writeOpening(); 42 | if (Settings::isOutputEscapingEnabled()) { 43 | $content .= "escaper->escapeHtmlAttr($this->element->getSource())}\">{$this->escaper->escapeHtml($this->element->getText())}"; 44 | } else { 45 | $content .= "element->getSource()}\">{$this->element->getText()}"; 46 | } 47 | $content .= $this->writeClosing(); 48 | 49 | return $content; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/HTML/Element/ListItem.php: -------------------------------------------------------------------------------- 1 | element instanceof \PhpOffice\PhpWord\Element\ListItem) { 37 | return ''; 38 | } 39 | 40 | if (Settings::isOutputEscapingEnabled()) { 41 | $content = '

' . $this->escaper->escapeHtml($this->element->getTextObject()->getText()) . '

' . PHP_EOL; 42 | } else { 43 | $content = '

' . $this->element->getTextObject()->getText() . '

' . PHP_EOL; 44 | } 45 | 46 | return $content; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/HTML/Element/PageBreak.php: -------------------------------------------------------------------------------- 1 | parentWriter; 38 | if ($parentWriter->isPdf()) { 39 | return ''; 40 | } 41 | 42 | return ""; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/HTML/Element/TextBreak.php: -------------------------------------------------------------------------------- 1 | withoutP) { 35 | $content = '
' . PHP_EOL; 36 | } else { 37 | $content = '

 

' . PHP_EOL; 38 | } 39 | 40 | return $content; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/HTML/Element/TextRun.php: -------------------------------------------------------------------------------- 1 | writeOpening(); 37 | $writer = new Container($this->parentWriter, $this->element); 38 | $content .= $writer->write(); 39 | $content .= $this->writeClosing(); 40 | 41 | return $content; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/HTML/Element/Title.php: -------------------------------------------------------------------------------- 1 | element instanceof \PhpOffice\PhpWord\Element\Title) { 37 | return ''; 38 | } 39 | 40 | $tag = 'h' . $this->element->getDepth(); 41 | if (Settings::isOutputEscapingEnabled()) { 42 | $text = $this->escaper->escapeHtml($this->element->getText()); 43 | } else { 44 | $text = $this->element->getText(); 45 | } 46 | $content = "<{$tag}>{$text}" . PHP_EOL; 47 | 48 | return $content; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/HTML/Style/Generic.php: -------------------------------------------------------------------------------- 1 | getStyle(); 35 | $css = array(); 36 | 37 | if (is_array($style) && !empty($style)) { 38 | $css = $style; 39 | } 40 | 41 | return $this->assembleCss($css); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/HTML/Style/Image.php: -------------------------------------------------------------------------------- 1 | getStyle(); 35 | if (!$style instanceof \PhpOffice\PhpWord\Style\Image) { 36 | return ''; 37 | } 38 | $css = array(); 39 | 40 | $width = $style->getWidth(); 41 | $height = $style->getHeight(); 42 | $css['width'] = $this->getValueIf(is_numeric($width), $width . 'px'); 43 | $css['height'] = $this->getValueIf(is_numeric($height), $height . 'px'); 44 | 45 | return $this->assembleCss($css); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/ODText/Element/AbstractElement.php: -------------------------------------------------------------------------------- 1 | getXmlWriter(); 33 | 34 | $xmlWriter->startElement('text:p'); 35 | $xmlWriter->writeAttribute('text:style-name', 'Standard'); 36 | $xmlWriter->endElement(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/ODText/Element/TextRun.php: -------------------------------------------------------------------------------- 1 | getXmlWriter(); 33 | $element = $this->getElement(); 34 | 35 | $xmlWriter->startElement('text:p'); 36 | 37 | $containerWriter = new Container($xmlWriter, $element); 38 | $containerWriter->write(); 39 | 40 | $xmlWriter->endElement(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/ODText/Element/Title.php: -------------------------------------------------------------------------------- 1 | getXmlWriter(); 35 | $element = $this->getElement(); 36 | if (!$element instanceof \PhpOffice\PhpWord\Element\Title) { 37 | return; 38 | } 39 | 40 | $xmlWriter->startElement('text:h'); 41 | $xmlWriter->writeAttribute('text:outline-level', $element->getDepth()); 42 | if (Settings::isOutputEscapingEnabled()) { 43 | $xmlWriter->text($element->getText()); 44 | } else { 45 | $xmlWriter->writeRaw($element->getText()); 46 | } 47 | $xmlWriter->endElement(); // text:h 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/ODText/Part/Mimetype.php: -------------------------------------------------------------------------------- 1 | getStyle(); 36 | if (!$style instanceof \PhpOffice\PhpWord\Style\Table) { 37 | return; 38 | } 39 | $xmlWriter = $this->getXmlWriter(); 40 | 41 | $xmlWriter->startElement('style:style'); 42 | $xmlWriter->writeAttribute('style:name', $style->getStyleName()); 43 | $xmlWriter->writeAttribute('style:family', 'table'); 44 | $xmlWriter->startElement('style:table-properties'); 45 | //$xmlWriter->writeAttribute('style:width', 'table'); 46 | $xmlWriter->writeAttribute('style:rel-width', 100); 47 | $xmlWriter->writeAttribute('table:align', 'center'); 48 | $xmlWriter->endElement(); // style:table-properties 49 | $xmlWriter->endElement(); // style:style 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/RTF/Element/Container.php: -------------------------------------------------------------------------------- 1 | element instanceof \PhpOffice\PhpWord\Element\Link) { 35 | return ''; 36 | } 37 | 38 | $this->getStyles(); 39 | 40 | $content = ''; 41 | $content .= $this->writeOpening(); 42 | $content .= '{\field {\*\fldinst {HYPERLINK "' . $this->element->getSource() . '"}}{\\fldrslt {'; 43 | $content .= $this->writeFontStyle(); 44 | $content .= $this->writeText($this->element->getText()); 45 | $content .= '}}}'; 46 | $content .= $this->writeClosing(); 47 | 48 | return $content; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/RTF/Element/ListItem.php: -------------------------------------------------------------------------------- 1 | element; 36 | $elementClass = str_replace('\\Writer\\RTF', '', get_class($this)); 37 | if (!$element instanceof $elementClass) { 38 | return ''; 39 | } 40 | 41 | $this->getStyles(); 42 | 43 | $content = ''; 44 | $content .= $this->writeOpening(); 45 | $content .= '{'; 46 | $content .= $this->writeFontStyle(); 47 | $content .= $this->writeText($element->getText()); 48 | $content .= '}'; 49 | $content .= $this->writeClosing(); 50 | 51 | return $content; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/RTF/Element/TextBreak.php: -------------------------------------------------------------------------------- 1 | parentWriter; 36 | $parentWriter->setLastParagraphStyle(); 37 | 38 | return '\pard\par' . PHP_EOL; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/RTF/Element/TextRun.php: -------------------------------------------------------------------------------- 1 | parentWriter, $this->element); 35 | 36 | $content = ''; 37 | $content .= $this->writeOpening(); 38 | $content .= '{'; 39 | $content .= $writer->write(); 40 | $content .= '}'; 41 | $content .= $this->writeClosing(); 42 | 43 | return $content; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/RTF/Element/Title.php: -------------------------------------------------------------------------------- 1 | getXmlWriter(); 33 | $element = $this->getElement(); 34 | if (!$element instanceof \PhpOffice\PhpWord\Element\Bookmark) { 35 | return; 36 | } 37 | 38 | $rId = $element->getRelationId(); 39 | 40 | $xmlWriter->startElement('w:bookmarkStart'); 41 | $xmlWriter->writeAttribute('w:id', $rId); 42 | $xmlWriter->writeAttribute('w:name', $element->getName()); 43 | $xmlWriter->endElement(); 44 | 45 | $xmlWriter->startElement('w:bookmarkEnd'); 46 | $xmlWriter->writeAttribute('w:id', $rId); 47 | $xmlWriter->endElement(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Element/Endnote.php: -------------------------------------------------------------------------------- 1 | getXmlWriter(); 36 | 37 | $xmlWriter->startElement('w:p'); 38 | $xmlWriter->startElement('w:r'); 39 | $xmlWriter->startElement('w:br'); 40 | $xmlWriter->writeAttribute('w:type', 'page'); 41 | $xmlWriter->endElement(); // w:br 42 | $xmlWriter->endElement(); // w:r 43 | $xmlWriter->endElement(); // w:p 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php: -------------------------------------------------------------------------------- 1 | attributes['w:val'] = $value; 39 | } 40 | 41 | /** 42 | * @since 0.13.0 43 | * 44 | * @return string 45 | */ 46 | final public function getName() 47 | { 48 | return $this->name; 49 | } 50 | 51 | /** 52 | * @since 0.13.0 53 | * 54 | * @return string[] 55 | */ 56 | final public function getAttributes() 57 | { 58 | return $this->attributes; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Element/TableAlignment.php: -------------------------------------------------------------------------------- 1 | attributes['w:val'] = $value; 39 | } 40 | 41 | /** 42 | * @since 0.13.0 43 | * 44 | * @return string 45 | */ 46 | final public function getName() 47 | { 48 | return $this->name; 49 | } 50 | 51 | /** 52 | * @since 0.13.0 53 | * 54 | * @return string[] 55 | */ 56 | final public function getAttributes() 57 | { 58 | return $this->attributes; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Element/TextBreak.php: -------------------------------------------------------------------------------- 1 | getXmlWriter(); 35 | $element = $this->getElement(); 36 | if (!$element instanceof \PhpOffice\PhpWord\Element\TextBreak) { 37 | return; 38 | } 39 | 40 | if (!$this->withoutP) { 41 | $hasStyle = $element->hasStyle(); 42 | $this->startElementP(); 43 | 44 | if ($hasStyle) { 45 | $xmlWriter->startElement('w:pPr'); 46 | $this->writeFontStyle(); 47 | $xmlWriter->endElement(); // w:pPr 48 | } 49 | 50 | $this->endElementP(); // w:p 51 | } else { 52 | $xmlWriter->writeElement('w:br'); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Element/TextRun.php: -------------------------------------------------------------------------------- 1 | getXmlWriter(); 35 | $element = $this->getElement(); 36 | 37 | $this->startElementP(); 38 | 39 | $containerWriter = new Container($xmlWriter, $element); 40 | $containerWriter->write(); 41 | 42 | $this->endElementP(); // w:p 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Part/Endnotes.php: -------------------------------------------------------------------------------- 1 | getXmlWriter(); 42 | $this->writeRels($xmlWriter, array(), $this->media); 43 | 44 | return $xmlWriter->getData(); 45 | } 46 | 47 | /** 48 | * Set media 49 | * 50 | * @param array $media 51 | * @return self 52 | */ 53 | public function setMedia($media) 54 | { 55 | $this->media = $media; 56 | 57 | return $this; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Part/WebSettings.php: -------------------------------------------------------------------------------- 1 | '', 34 | ); 35 | 36 | $xmlWriter = $this->getXmlWriter(); 37 | 38 | $xmlWriter->startDocument('1.0', 'UTF-8', 'yes'); 39 | $xmlWriter->startElement('w:webSettings'); 40 | $xmlWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'); 41 | $xmlWriter->writeAttribute('xmlns:w', 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'); 42 | 43 | foreach ($settings as $settingKey => $settingValue) { 44 | $this->writeSetting($xmlWriter, $settingKey, $settingValue); 45 | } 46 | 47 | $xmlWriter->endElement(); // w:settings 48 | 49 | return $xmlWriter->getData(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Style/Extrusion.php: -------------------------------------------------------------------------------- 1 | getStyle(); 35 | if (!$style instanceof \PhpOffice\PhpWord\Style\Extrusion) { 36 | return; 37 | } 38 | $xmlWriter = $this->getXmlWriter(); 39 | 40 | $xmlWriter->startElement("o:extrusion"); 41 | $xmlWriter->writeAttribute('on', 't'); 42 | $xmlWriter->writeAttributeIf($style->getType() !== null, 'type', $style->getType()); 43 | $xmlWriter->writeAttributeIf($style->getColor() !== null, 'color', $style->getColor()); 44 | $xmlWriter->endElement(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Style/Fill.php: -------------------------------------------------------------------------------- 1 | getStyle(); 35 | if (!$style instanceof \PhpOffice\PhpWord\Style\Fill) { 36 | return; 37 | } 38 | $xmlWriter = $this->getXmlWriter(); 39 | 40 | $xmlWriter->writeAttribute('on', 't'); 41 | $xmlWriter->writeAttributeIf($style->getColor() !== null, 'fillcolor', $style->getColor()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Style/Image.php: -------------------------------------------------------------------------------- 1 | getStyle(); 35 | if (!$style instanceof \PhpOffice\PhpWord\Style\Indentation) { 36 | return; 37 | } 38 | $xmlWriter = $this->getXmlWriter(); 39 | 40 | $xmlWriter->startElement('w:ind'); 41 | 42 | $xmlWriter->writeAttribute('w:left', $this->convertTwip($style->getLeft())); 43 | $xmlWriter->writeAttribute('w:right', $this->convertTwip($style->getRight())); 44 | 45 | $firstLine = $style->getFirstLine(); 46 | $xmlWriter->writeAttributeIf(!is_null($firstLine), 'w:firstLine', $this->convertTwip($firstLine)); 47 | 48 | $hanging = $style->getHanging(); 49 | $xmlWriter->writeAttributeIf(!is_null($hanging), 'w:hanging', $this->convertTwip($hanging)); 50 | 51 | $xmlWriter->endElement(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Style/LineNumbering.php: -------------------------------------------------------------------------------- 1 | getStyle(); 37 | if (!$style instanceof \PhpOffice\PhpWord\Style\LineNumbering) { 38 | return; 39 | } 40 | $xmlWriter = $this->getXmlWriter(); 41 | 42 | $xmlWriter->startElement('w:lnNumType'); 43 | $xmlWriter->writeAttribute('w:start', $style->getStart() - 1); 44 | $xmlWriter->writeAttribute('w:countBy', $style->getIncrement()); 45 | $xmlWriter->writeAttribute('w:distance', $style->getDistance()); 46 | $xmlWriter->writeAttribute('w:restart', $style->getRestart()); 47 | $xmlWriter->endElement(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Style/Shading.php: -------------------------------------------------------------------------------- 1 | getStyle(); 35 | if (!$style instanceof \PhpOffice\PhpWord\Style\Shading) { 36 | return; 37 | } 38 | $xmlWriter = $this->getXmlWriter(); 39 | 40 | $xmlWriter->startElement('w:shd'); 41 | $xmlWriter->writeAttribute('w:val', $style->getPattern()); 42 | $xmlWriter->writeAttribute('w:color', $style->getColor()); 43 | $xmlWriter->writeAttribute('w:fill', $style->getFill()); 44 | $xmlWriter->endElement(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Style/Shadow.php: -------------------------------------------------------------------------------- 1 | getStyle(); 35 | if (!$style instanceof \PhpOffice\PhpWord\Style\Shadow) { 36 | return; 37 | } 38 | $xmlWriter = $this->getXmlWriter(); 39 | 40 | $xmlWriter->startElement("v:shadow"); 41 | $xmlWriter->writeAttribute('on', 't'); 42 | $xmlWriter->writeAttributeIf($style->getColor() !== null, 'color', $style->getColor()); 43 | $xmlWriter->writeAttributeIf($style->getOffset() !== null, 'offset', $style->getOffset()); 44 | $xmlWriter->endElement(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Style/Shape.php: -------------------------------------------------------------------------------- 1 | getStyle(); 35 | if (!$style instanceof \PhpOffice\PhpWord\Style\Shape) { 36 | return; 37 | } 38 | 39 | $xmlWriter = $this->getXmlWriter(); 40 | 41 | $childStyles = array('Frame', 'Fill', 'Outline', 'Shadow', 'Extrusion'); 42 | foreach ($childStyles as $childStyle) { 43 | $method = "get{$childStyle}"; 44 | $this->writeChildStyle($xmlWriter, $childStyle, $style->$method()); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/Word2007/Style/Tab.php: -------------------------------------------------------------------------------- 1 | getStyle(); 35 | if (!$style instanceof \PhpOffice\PhpWord\Style\Tab) { 36 | return; 37 | } 38 | $xmlWriter = $this->getXmlWriter(); 39 | 40 | $xmlWriter->startElement("w:tab"); 41 | $xmlWriter->writeAttribute("w:val", $style->getType()); 42 | $xmlWriter->writeAttribute("w:leader", $style->getLeader()); 43 | $xmlWriter->writeAttribute('w:pos', $this->convertTwip($style->getPosition())); 44 | $xmlWriter->endElement(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/PhpWord/Writer/WriterInterface.php: -------------------------------------------------------------------------------- 1 | addItem(new Footnote()); // addItem #1 36 | 37 | $this->assertEquals(2, $object->addItem(new Footnote())); // addItem #2. Should returns new item index 38 | $this->assertCount(2, $object->getItems()); // getItems returns array 39 | $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Footnote', $object->getItem(1)); // getItem returns object 40 | $this->assertNull($object->getItem(3)); // getItem returns null when invalid index is referenced 41 | 42 | $object->setItem(2, null); // Set item #2 to null 43 | 44 | $this->assertNull($object->getItem(2)); // Check if it's null 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tests/PhpWord/Element/AbstractElementTest.php: -------------------------------------------------------------------------------- 1 | getMockForAbstractClass('\PhpOffice\PhpWord\Element\AbstractElement'); 31 | $ival = rand(0, 100); 32 | $stub->setElementIndex($ival); 33 | $this->assertEquals($ival, $stub->getElementIndex()); 34 | } 35 | 36 | /** 37 | * Test set/get element unique Id 38 | */ 39 | public function testElementId() 40 | { 41 | $stub = $this->getMockForAbstractClass('\PhpOffice\PhpWord\Element\AbstractElement'); 42 | $stub->setElementId(); 43 | $this->assertEquals(6, strlen($stub->getElementId())); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /tests/PhpWord/Element/PageBreakTest.php: -------------------------------------------------------------------------------- 1 | assertInstanceOf('PhpOffice\\PhpWord\\Element\\PageBreak', $oPageBreak); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/PhpWord/Element/TitleTest.php: -------------------------------------------------------------------------------- 1 | assertInstanceOf('PhpOffice\\PhpWord\\Element\\Title', $oTitle); 36 | $this->assertEquals('text', $oTitle->getText()); 37 | } 38 | 39 | /** 40 | * Get style null 41 | */ 42 | public function testStyleNull() 43 | { 44 | $oTitle = new Title('text'); 45 | 46 | $this->assertNull($oTitle->getStyle()); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/PhpWord/Exception/CopyFileExceptionTest.php: -------------------------------------------------------------------------------- 1 | assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord); 38 | } 39 | 40 | /** 41 | * Test load exception 42 | * 43 | * @expectedException \Exception 44 | * @expectedExceptionMessage Cannot read 45 | */ 46 | public function testLoadException() 47 | { 48 | $filename = __DIR__ . '/../_files/documents/foo.html'; 49 | IOFactory::load($filename, 'HTML'); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tests/PhpWord/Reader/ODTextTest.php: -------------------------------------------------------------------------------- 1 | assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/PhpWord/Reader/RTFTest.php: -------------------------------------------------------------------------------- 1 | assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord); 38 | } 39 | 40 | /** 41 | * Test load exception 42 | * 43 | * @expectedException \Exception 44 | * @expectedExceptionMessage Cannot read 45 | */ 46 | public function testLoadException() 47 | { 48 | $filename = __DIR__ . '/../_files/documents/foo.rtf'; 49 | IOFactory::load($filename, 'RTF'); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tests/PhpWord/Style/IndentationTest.php: -------------------------------------------------------------------------------- 1 | array(0, 10), 35 | 'right' => array(0, 10), 36 | 'firstLine' => array(null, 20), 37 | 'hanging' => array(null, 20), 38 | ); 39 | foreach ($properties as $property => $value) { 40 | list($default, $expected) = $value; 41 | $get = "get{$property}"; 42 | $set = "set{$property}"; 43 | 44 | $this->assertEquals($default, $object->$get()); // Default value 45 | 46 | $object->$set($expected); 47 | 48 | $this->assertEquals($expected, $object->$get()); // New value 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tests/PhpWord/Style/LineNumberingTest.php: -------------------------------------------------------------------------------- 1 | array(1, 2), 35 | 'increment' => array(1, 10), 36 | 'distance' => array(null, 10), 37 | 'restart' => array(null, 'continuous'), 38 | ); 39 | foreach ($properties as $property => $value) { 40 | list($default, $expected) = $value; 41 | $get = "get{$property}"; 42 | $set = "set{$property}"; 43 | 44 | $this->assertEquals($default, $object->$get()); // Default value 45 | 46 | $object->$set($expected); 47 | 48 | $this->assertEquals($expected, $object->$get()); // New value 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tests/PhpWord/Style/ShadingTest.php: -------------------------------------------------------------------------------- 1 | array('clear', 'solid'), 35 | 'color' => array(null, 'FF0000'), 36 | 'fill' => array(null, 'FF0000'), 37 | ); 38 | foreach ($properties as $property => $value) { 39 | list($default, $expected) = $value; 40 | $get = "get{$property}"; 41 | $set = "set{$property}"; 42 | 43 | $this->assertEquals($default, $object->$get()); // Default value 44 | 45 | $object->$set($expected); 46 | 47 | $this->assertEquals($expected, $object->$get()); // New value 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/PhpWord/Style/SpacingTest.php: -------------------------------------------------------------------------------- 1 | array(null, 10), 35 | 'after' => array(null, 10), 36 | 'line' => array(null, 10), 37 | 'rule' => array('auto', 'exact'), 38 | ); 39 | foreach ($properties as $property => $value) { 40 | list($default, $expected) = $value; 41 | $get = "get{$property}"; 42 | $set = "set{$property}"; 43 | 44 | $this->assertEquals($default, $object->$get()); // Default value 45 | 46 | $object->$set($expected); 47 | 48 | $this->assertEquals($expected, $object->$get()); // New value 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tests/PhpWord/Style/TOCTest.php: -------------------------------------------------------------------------------- 1 | array(TOC::TAB_LEADER_DOT, TOC::TAB_LEADER_UNDERSCORE), 35 | 'tabPos' => array(9062, 10), 36 | 'indent' => array(200, 10), 37 | ); 38 | foreach ($properties as $property => $value) { 39 | list($default, $expected) = $value; 40 | $get = "get{$property}"; 41 | $set = "set{$property}"; 42 | 43 | $this->assertEquals($default, $object->$get()); // Default value 44 | 45 | $object->$set($expected); 46 | 47 | $this->assertEquals($expected, $object->$get()); // New value 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/PhpWord/Style/TabTest.php: -------------------------------------------------------------------------------- 1 | array(Tab::TAB_STOP_CLEAR, Tab::TAB_STOP_RIGHT), 35 | 'leader' => array(Tab::TAB_LEADER_NONE, Tab::TAB_LEADER_DOT), 36 | 'position' => array(0, 10), 37 | ); 38 | foreach ($properties as $property => $value) { 39 | list($default, $expected) = $value; 40 | $get = "get{$property}"; 41 | $set = "set{$property}"; 42 | 43 | $this->assertEquals($default, $object->$get()); // Default value 44 | 45 | $object->$set($expected); 46 | 47 | $this->assertEquals($expected, $object->$get()); // New value 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/PhpWord/Writer/HTML/PartTest.php: -------------------------------------------------------------------------------- 1 | getParentWriter(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/PhpWord/Writer/HTML/StyleTest.php: -------------------------------------------------------------------------------- 1 | assertEquals('', $object->write()); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/PhpWord/Writer/ODText/ElementTest.php: -------------------------------------------------------------------------------- 1 | write(); 38 | 39 | $this->assertEquals('', $xmlWriter->getData()); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tests/PhpWord/Writer/ODText/StyleTest.php: -------------------------------------------------------------------------------- 1 | write(); 37 | 38 | $this->assertEquals('', $xmlWriter->getData()); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/PhpWord/Writer/PDF/MPDFTest.php: -------------------------------------------------------------------------------- 1 | addSection(); 39 | $section->addText('Test 1'); 40 | 41 | $rendererName = Settings::PDF_RENDERER_MPDF; 42 | $rendererLibraryPath = realpath(PHPWORD_TESTS_BASE_DIR . '/../vendor/mpdf/mpdf'); 43 | Settings::setPdfRenderer($rendererName, $rendererLibraryPath); 44 | $writer = new PDF($phpWord); 45 | $writer->save($file); 46 | 47 | $this->assertTrue(file_exists($file)); 48 | 49 | unlink($file); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tests/PhpWord/Writer/PDF/TCPDFTest.php: -------------------------------------------------------------------------------- 1 | addSection(); 39 | $section->addText('Test 1'); 40 | 41 | $rendererName = Settings::PDF_RENDERER_TCPDF; 42 | $rendererLibraryPath = realpath(PHPWORD_TESTS_BASE_DIR . '/../vendor/tecnickcom/tcpdf'); 43 | Settings::setPdfRenderer($rendererName, $rendererLibraryPath); 44 | $writer = new PDF($phpWord); 45 | $writer->save($file); 46 | 47 | $this->assertTrue(file_exists($file)); 48 | 49 | unlink($file); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /tests/PhpWord/Writer/RTF/ElementTest.php: -------------------------------------------------------------------------------- 1 | assertEquals('', $object->write()); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/PhpWord/Writer/RTF/StyleTest.php: -------------------------------------------------------------------------------- 1 | assertEquals('', $object->write()); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/PhpWord/Writer/Word2007/PartTest.php: -------------------------------------------------------------------------------- 1 | setMedia(array(array('type' => '', 'target' => ''))); 39 | $object->write(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/PhpWord/Writer/Word2007/Style/FontTest.php: -------------------------------------------------------------------------------- 1 | addSection(); 44 | $textrun = $section->addTextRun(); 45 | $textrun->addText('سلام این یک پاراگراف راست به چپ است', array('rtl' => true)); 46 | $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); 47 | 48 | $file = 'word/document.xml'; 49 | $path = '/w:document/w:body/w:p/w:r/w:rPr/w:rtl'; 50 | $this->assertTrue($doc->elementExists($path, $file)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /tests/PhpWord/_files/documents/reader.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/documents/reader.docx -------------------------------------------------------------------------------- /tests/PhpWord/_files/documents/reader.docx.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/documents/reader.docx.zip -------------------------------------------------------------------------------- /tests/PhpWord/_files/documents/reader.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PHPWord 5 | 6 | 7 |

Adding element via HTML

8 |

Some well formed HTML snippet needs to be used

9 |

With for example some1 inline formatting1

10 |

Unordered (bulleted) list:

11 |
  • Item 1
  • Item 2
    • Item 2.1
    • Item 2.1
12 |

Ordered (numbered) list:

13 |
  1. Item 1
  2. Item 2
14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/PhpWord/_files/documents/reader.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/documents/reader.odt -------------------------------------------------------------------------------- /tests/PhpWord/_files/documents/reader.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1 2 | \ansi\ansicpg1252 3 | \deff0 4 | {\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset0 Times New Roman;}} 5 | {\colortbl;\red255\green0\blue0;\red14\green0\blue0} 6 | {\*\generator PhpWord;} 7 | 8 | {\info{\title }{\subject }{\category }{\keywords }{\comment }{\author }{\operator }{\creatim \yr2014\mo05\dy27\hr23\min36\sec45}{\revtim \yr2014\mo05\dy27\hr23\min36\sec45}{\company }{\manager }} 9 | \deftab720\viewkind1\uc1\pard\nowidctlpar\lang1036\kerning1\fs20 10 | {Welcome to PhpWord}\par 11 | \pard\nowidctlpar{\cf0\f0 Hello World!}\par 12 | \par 13 | \par 14 | \pard\nowidctlpar{\cf0\f0\fs32\b\i I am styled by a definition.}\par 15 | \pard\nowidctlpar{\cf0\f0 I am styled by a paragraph style definition.}\par 16 | \pard\nowidctlpar\qc\sa100{\cf0\f0\fs32\b\i I am styled by both font and paragraph style.}\par 17 | \pard\nowidctlpar{\cf1\f1\fs40\b\i\ul\strike\super I am inline styled.}\par 18 | \par 19 | {\field {\*\fldinst {HYPERLINK "https://github.com/PHPOffice/PHPWord"}}{\fldrslt {PHPWord on GitHub}}}\par 20 | \par 21 | } -------------------------------------------------------------------------------- /tests/PhpWord/_files/documents/sheet.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/documents/sheet.xls -------------------------------------------------------------------------------- /tests/PhpWord/_files/documents/without_table_macros.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/documents/without_table_macros.docx -------------------------------------------------------------------------------- /tests/PhpWord/_files/images/PhpWord.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/images/PhpWord.png -------------------------------------------------------------------------------- /tests/PhpWord/_files/images/alexz-johnson.pcx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/images/alexz-johnson.pcx -------------------------------------------------------------------------------- /tests/PhpWord/_files/images/angela_merkel.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/images/angela_merkel.tif -------------------------------------------------------------------------------- /tests/PhpWord/_files/images/duke_nukem.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/images/duke_nukem.bmp -------------------------------------------------------------------------------- /tests/PhpWord/_files/images/earth.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/images/earth.jpg -------------------------------------------------------------------------------- /tests/PhpWord/_files/images/firefox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/images/firefox.png -------------------------------------------------------------------------------- /tests/PhpWord/_files/images/mario.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/images/mario.gif -------------------------------------------------------------------------------- /tests/PhpWord/_files/images/mars.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/images/mars.jpg -------------------------------------------------------------------------------- /tests/PhpWord/_files/images/mars_noext_jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/images/mars_noext_jpg -------------------------------------------------------------------------------- /tests/PhpWord/_files/templates/blank.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/templates/blank.docx -------------------------------------------------------------------------------- /tests/PhpWord/_files/templates/clone-delete-block.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/templates/clone-delete-block.docx -------------------------------------------------------------------------------- /tests/PhpWord/_files/templates/clone-merge.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/templates/clone-merge.docx -------------------------------------------------------------------------------- /tests/PhpWord/_files/templates/corrupted_main_document_part.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/templates/corrupted_main_document_part.docx -------------------------------------------------------------------------------- /tests/PhpWord/_files/templates/header-footer.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/templates/header-footer.docx -------------------------------------------------------------------------------- /tests/PhpWord/_files/templates/with_table_macros.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SpartnerNL/PHPWord/e6f8a232bc57eb19a40dc0ccd876b21aaac26ba1/tests/PhpWord/_files/templates/with_table_macros.docx -------------------------------------------------------------------------------- /tests/PhpWord/_files/xsl/passthrough.xsl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/PhpWord/_files/xsl/remove_tables_by_needle.xsl: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/bootstrap.php: -------------------------------------------------------------------------------- 1 |