PhpWord очищает все элементы списка при чтении docx (загружается из googledocs).вопрос - PullRequest
0 голосов
/ 09 февраля 2019

У меня есть файл docx со списками элементов.сначала у меня есть нумерованный список: 1. test1 2. test2

затем простой текст вроде: test3 test4

затем простой список:

  • test5
  • test6

Я хочу прочитать этот документ с помощью PhpWord и вывести его в виде HTML.Итак, мой код:

$phpWord = \PhpOffice\PhpWord\IOFactory::load("test5.docx");
$htmlWriter = new \PhpOffice\PhpWord\Writer\HTML($phpWord);
$htmlWriter->save('php://output');

после этого я вижу только: test3 test4

Оба списка были очищены.Почему и что мне делать?

Информация о моем phpword композиторе:

{
    "name": "phpoffice/phpword",
    "description": "PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)",
    "keywords": [
        "PHP", "PHPOffice", "office", "PHPWord", "word", "template", "template processor", "reader", "writer",
        "docx", "OOXML", "OpenXML", "Office Open XML", "ISO IEC 29500", "WordprocessingML",
        "RTF", "Rich Text Format", "doc", "odt", "ODF", "OpenDocument", "PDF", "HTML"
    ],
    "homepage": "http://phpoffice.github.io",
    "type": "library",
    "license": "LGPL-3.0",
    "authors": [
        {
            "name": "Mark Baker"
        },
        {
            "name": "Gabriel Bull",
            "email": "me@gabrielbull.com",
            "homepage": "http://gabrielbull.com/"
        },
        {
            "name": "Franck Lefevre",
            "homepage": "https://rootslabs.net/blog/"
        },
        {
            "name": "Ivan Lanin",
            "homepage": "http://ivan.lanin.org"
        },
        {
            "name": "Roman Syroeshko",
            "homepage": "http://ru.linkedin.com/pub/roman-syroeshko/34/a53/994/"
        },
        {
            "name": "Antoine de Troostembergh"
        }
    ],
    "scripts": {
        "test": [
            "phpunit --color=always"
        ],
        "test-no-coverage": [
            "phpunit --color=always --no-coverage"
        ],
        "check": [
            "php-cs-fixer fix --ansi --dry-run --diff",
            "phpcs --report-width=200 --report-summary  --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n",
            "phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php",
            "@test-no-coverage"
        ],
        "fix": [
            "php-cs-fixer fix --ansi"
        ]
    },
    "scripts-descriptions": {
        "test": "Runs all unit tests",
        "test-no-coverage": "Runs all unit tests, without code coverage",
        "check": "Runs PHP CheckStyle and PHP Mess detector",
        "fix": "Fixes issues found by PHP-CS"
    },
    "require": {
        "php": "^5.3.3 || ^7.0",
        "ext-xml": "*",
        "zendframework/zend-escaper": "^2.2",
        "phpoffice/common": "^0.2.9"
    },
    "require-dev": {
        "ext-zip": "*",
        "ext-gd": "*",
        "phpunit/phpunit": "^4.8.36 || ^7.0",
        "squizlabs/php_codesniffer": "^2.9",
        "friendsofphp/php-cs-fixer": "^2.2",
        "phpmd/phpmd": "2.*",
        "phploc/phploc": "2.* || 3.* || 4.*",
        "dompdf/dompdf":"0.8.*",
        "tecnickcom/tcpdf": "6.*",
        "mpdf/mpdf": "5.7.4 || 6.* || 7.*",
        "php-coveralls/php-coveralls": "1.1.0 || ^2.0"
    },
    "suggest": {
        "ext-zip": "Allows writing OOXML and ODF",
        "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",
        "dompdf/dompdf": "Allows writing PDF"
    },
    "autoload": {
        "psr-4": {
            "PhpOffice\\PhpWord\\": "src/PhpWord"
        }
    },
    "extra": {
        "branch-alias": {
            "dev-develop": "0.17-dev"
        }
    }
}
...