Skip to content

Instantly share code, notes, and snippets.

@petrknap
Last active September 1, 2016 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petrknap/c76e94d61374da52690bdefe43497768 to your computer and use it in GitHub Desktop.
Save petrknap/c76e94d61374da52690bdefe43497768 to your computer and use it in GitHub Desktop.
PHPOffice/PHPWord: MsDoc - Czech language support #881
{
"require": {
"phpoffice/phpword": "*"
}
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "bcf3eac5a901fe26e95567e8462267c0",
"content-hash": "175f515b2811e085f3258b59792b25af",
"packages": [
{
"name": "pclzip/pclzip",
"version": "2.8.2",
"source": {
"type": "git",
"url": "https://github.com/ivanlanin/pclzip.git",
"reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ivanlanin/pclzip/zipball/19dd1de9d3f5fc4d7d70175b4c344dee329f45fd",
"reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd",
"shasum": ""
},
"type": "library",
"autoload": {
"classmap": [
"pclzip.lib.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "Vincent Blavet"
}
],
"description": "A PHP library that offers compression and extraction functions for Zip formatted archives",
"homepage": "http://www.phpconcept.net/pclzip",
"keywords": [
"php",
"zip"
],
"time": "2014-06-05 11:42:24"
},
{
"name": "phpoffice/common",
"version": "v0.2.6",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/Common.git",
"reference": "c9be70c80637c28c728be78e66aad4878a34f8dd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/Common/zipball/c9be70c80637c28c728be78e66aad4878a34f8dd",
"reference": "c9be70c80637c28c728be78e66aad4878a34f8dd",
"shasum": ""
},
"require": {
"pclzip/pclzip": "^2.8",
"php": ">=5.3.0"
},
"require-dev": {
"phpdocumentor/phpdocumentor": "2.*",
"phploc/phploc": "2.*",
"phpmd/phpmd": "2.*",
"phpunit/phpunit": "3.7.*",
"sebastian/phpcpd": "2.*",
"squizlabs/php_codesniffer": "2.*"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpOffice\\Common\\": "src/Common/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL"
],
"authors": [
{
"name": "Mark Baker"
},
{
"name": "Franck Lefevre",
"homepage": "http://rootslabs.net"
}
],
"description": "PHPOffice Common",
"homepage": "http://phpoffice.github.io",
"keywords": [
"common",
"component",
"office",
"php"
],
"time": "2016-07-07 17:26:55"
},
{
"name": "phpoffice/phpword",
"version": "v0.13.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PHPWord.git",
"reference": "0a3f873972defb304de4fa2f5f53156558c11a7a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPWord/zipball/0a3f873972defb304de4fa2f5f53156558c11a7a",
"reference": "0a3f873972defb304de4fa2f5f53156558c11a7a",
"shasum": ""
},
"require": {
"ext-xml": "*",
"php": ">=5.3.3",
"phpoffice/common": "0.2.*",
"zendframework/zend-escaper": "2.4.*",
"zendframework/zend-stdlib": "2.4.*",
"zendframework/zend-validator": "2.4.*"
},
"require-dev": {
"dompdf/dompdf": "0.6.*",
"mpdf/mpdf": "5.*",
"phpdocumentor/phpdocumentor": "2.*",
"phploc/phploc": "2.*",
"phpmd/phpmd": "2.*",
"phpunit/phpunit": "3.7.*",
"squizlabs/php_codesniffer": "1.*",
"tecnickcom/tcpdf": "6.*"
},
"suggest": {
"dompdf/dompdf": "Allows writing PDF",
"ext-gd2": "Allows adding images",
"ext-xmlwriter": "Allows writing OOXML and ODF",
"ext-xsl": "Allows applying XSL style sheet to headers, to main document part, and to footers of an OOXML template",
"ext-zip": "Allows writing OOXML and ODF"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpOffice\\PhpWord\\": "src/PhpWord"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
],
"authors": [
{
"name": "Mark Baker"
},
{
"name": "Franck Lefevre",
"homepage": "http://blog.rootslabs.net"
},
{
"name": "Gabriel Bull",
"email": "me@gabrielbull.com",
"homepage": "http://gabrielbull.com/"
},
{
"name": "Ivan Lanin",
"homepage": "http://ivan.lanin.org"
},
{
"name": "Roman Syroeshko",
"homepage": "http://ru.linkedin.com/pub/roman-syroeshko/34/a53/994/"
}
],
"description": "PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)",
"homepage": "http://phpoffice.github.io",
"keywords": [
"ISO IEC 29500",
"OOXML",
"Office Open XML",
"OpenDocument",
"OpenXML",
"PhpOffice",
"PhpWord",
"Rich Text Format",
"WordprocessingML",
"doc",
"docx",
"html",
"odf",
"odt",
"office",
"pdf",
"php",
"reader",
"rtf",
"template",
"template processor",
"word",
"writer"
],
"time": "2016-07-31 08:53:39"
},
{
"name": "zendframework/zend-escaper",
"version": "2.4.10",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-escaper.git",
"reference": "13f468ff824f3c83018b90aff892a1b3201383a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/13f468ff824f3c83018b90aff892a1b3201383a9",
"reference": "13f468ff824f3c83018b90aff892a1b3201383a9",
"shasum": ""
},
"require": {
"php": ">=5.3.23"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "dev-master"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev",
"dev-develop": "2.5-dev"
}
},
"autoload": {
"psr-4": {
"Zend\\Escaper\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zend-escaper",
"keywords": [
"escaper",
"zf2"
],
"time": "2015-05-07 14:55:31"
},
{
"name": "zendframework/zend-stdlib",
"version": "2.4.10",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-stdlib.git",
"reference": "d8ecb629a72da9f91bd95c5af006384823560b42"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/d8ecb629a72da9f91bd95c5af006384823560b42",
"reference": "d8ecb629a72da9f91bd95c5af006384823560b42",
"shasum": ""
},
"require": {
"php": ">=5.3.23"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "dev-master",
"zendframework/zend-eventmanager": "self.version",
"zendframework/zend-filter": "self.version",
"zendframework/zend-serializer": "self.version",
"zendframework/zend-servicemanager": "self.version"
},
"suggest": {
"zendframework/zend-eventmanager": "To support aggregate hydrator usage",
"zendframework/zend-filter": "To support naming strategy hydrator usage",
"zendframework/zend-serializer": "Zend\\Serializer component",
"zendframework/zend-servicemanager": "To support hydrator plugin manager usage"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev",
"dev-develop": "2.5-dev"
}
},
"autoload": {
"psr-4": {
"Zend\\Stdlib\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"homepage": "https://github.com/zendframework/zend-stdlib",
"keywords": [
"stdlib",
"zf2"
],
"time": "2015-07-21 13:55:46"
},
{
"name": "zendframework/zend-validator",
"version": "2.4.10",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-validator.git",
"reference": "81415511fe729e6de19a61936313cef43c80d337"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-validator/zipball/81415511fe729e6de19a61936313cef43c80d337",
"reference": "81415511fe729e6de19a61936313cef43c80d337",
"shasum": ""
},
"require": {
"php": ">=5.3.23",
"zendframework/zend-stdlib": "~2.4.0"
},
"require-dev": {
"fabpot/php-cs-fixer": "1.7.*",
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "dev-master",
"zendframework/zend-config": "~2.4.0",
"zendframework/zend-db": "~2.4.0",
"zendframework/zend-filter": "~2.4.0",
"zendframework/zend-i18n": "~2.4.0",
"zendframework/zend-math": "~2.4.0",
"zendframework/zend-servicemanager": "~2.4.0",
"zendframework/zend-session": "~2.4.0",
"zendframework/zend-uri": "~2.4.0"
},
"suggest": {
"zendframework/zend-db": "Zend\\Db component",
"zendframework/zend-filter": "Zend\\Filter component, required by the Digits validator",
"zendframework/zend-i18n": "Zend\\I18n component to allow translation of validation error messages as well as to use the various Date validators",
"zendframework/zend-math": "Zend\\Math component",
"zendframework/zend-resources": "Translations of validator messages",
"zendframework/zend-servicemanager": "Zend\\ServiceManager component to allow using the ValidatorPluginManager and validator chains",
"zendframework/zend-session": "Zend\\Session component",
"zendframework/zend-uri": "Zend\\Uri component, required by the Uri and Sitemap\\Loc validators"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.4-dev",
"dev-develop": "2.5-dev"
}
},
"autoload": {
"psr-4": {
"Zend\\Validator\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "provides a set of commonly needed validators",
"homepage": "https://github.com/zendframework/zend-validator",
"keywords": [
"validator",
"zf2"
],
"time": "2015-09-08 21:04:17"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
<?php
include_once __DIR__ . "/vendor/autoload.php";
/** @var PhpOffice\PhpWord\PhpWord $word */
$word = PhpOffice\PhpWord\IOFactory::load("document.doc", "MsDoc");
/** @var PhpOffice\PhpWord\Element\Section[] $sections */
$sections = $word->getSections();
/** @var PhpOffice\PhpWord\Element\Text[] $elements */
$elements = $sections[0]->getElements();
$expected = "Příliš žluťoučký kůň pěl ďábelské ódy";
$content = $elements[0]->getText();
assert($content == $expected, "Expected that '{$content}' is equal to '{$expected}'");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment