Writer WPS: basic support of Microsoft Works documents - #2929
Writer WPS: basic support of Microsoft Works documents#2929businessarshgoyal wants to merge 3 commits into
Conversation
Add a WPS writer producing an OLE compound file whose CONTENTS stream holds the CHNKWKS chunks of the document, with the text and the page breaks of the elements. Co-Authored-By: business.arshgoyal@gmail.com <business.arshgoyal@gmail.com>
Co-Authored-By: business.arshgoyal@gmail.com <business.arshgoyal@gmail.com>
Progi1984
left a comment
There was a problem hiding this comment.
Rather than adding file src/PhpWord/Shared/OLEWrite.php, could use PhpOffice/Common ?
|
Happy to, but PhpOffice/Common only has Two ways I can go, tell me which you prefer:
Default is 2 unless you say otherwise |
|
Go to 1 |
|
Done: PHPOffice/Common#65 adds Once that lands and Common tags a release, I'll update this PR to require |
Co-Authored-By: business.arshgoyal@gmail.com <business.arshgoyal@gmail.com>
|
@businessarshgoyal It's published : https://github.com/PHPOffice/Common/releases/tag/1.1.0 |
Description
Adds a
WPSwriter producing documents for the word processor of Microsoft Works 7 and 8, ie an OLE compound file whoseCONTENTSstream holds theCHNKWKSchunks of the document, as described by the format notes linked in the issue and implemented by libwps (WPS8Parser).What is added:
Shared\OLEWrite: a small compound file (CFB v3, 512 bytes sectors) writer, counterpart of the existingShared\OLERead, building the FAT, the mini FAT, the mini stream and the red-black directory from a set of named streams. No new dependency.Writer\WPSandWriter\WPS\Part\Contents, following the structure of theRTFwriter: the part writes the stream header, the chunk index and theTEXTandFONTchunks; the text is UTF-16LE, paragraphs are terminated by\rand page breaks by\f.WPSinIOFactory::createWriter().First iteration scope, as suggested in the issue: text and basic paragraph output. Text, text runs, titles, links, list items, text breaks, page breaks and the text of the cells of a table are written as paragraphs. Not supported yet (silently ignored, no error): character and paragraph styles, table and list structure, images, objects, headers, footers, footnotes, endnotes, comments, table of contents, document properties, form fields, and reading
.wpsfiles.About #2769
I looked at #2769 first and did not build on it: it writes a ZIP package of ODF-like XML parts (
content.xml,styles.xml,META-INF/manifest.xml), which is not the Microsoft Works binary format the issue asks for — such a file is not an OLE document and is not recognised by Works or by libwps-based readers (LibreOffice). This PR writes theCONTENTS/CHNKWKSstream instead, so the two approaches do not share code.Validation
Besides the unit tests, the generated files were checked against the reference implementation,
wps2text(libwps 0.4.12), which extracts the expected text, and againstolefile/file(1), which validate the compound file structure.Fixes #69
/claim #69
Checklist: