PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents
https://phpoffice.github.io/PHPWord/
Other
7.27k stars 2.7k forks source link

Page Usage "mirrored" missing #1177

Open 1manfactory opened 7 years ago

1manfactory commented 7 years ago

When creating book to be printed on paper you need different inner and outer margin. The inner margin uses to be wider because of the gutter.

I made a bit of reverse engineering on an OpenOffice document.

<style:page-layout style:name="Mpm1" style:page-usage="mirrored">

How can I apply this? Or do I have do wait for future versions?

I can't find the keyword "mirrored" anywhere in the sources.

FBnil commented 7 years ago

As a quick hack or as a solution?

As a quick hack (for usage of creating an empty document and using add*() functions to add sections and text):

in file ./src/PhpWord/Writer/ODText/Part/Styles.php, search for function writePageLayout() and add it between the others.

        $xmlWriter->startElement('style:page-layout');
        $xmlWriter->writeAttribute('style:name', 'Mpm1');
        $xmlWriter->writeAttribute('style:page-usage', 'mirrored');
1manfactory commented 7 years ago

That's a good idea. But i never touch the original source codes as I will never be able to keep track of all customized stuff when doing updates.

troosan commented 7 years ago

I implemented it for docx documents, nothing for ODT documents so far :-( see PR #1183

troosan commented 6 years ago

@1manfactory Do you need an implementation for ODT or are you generating a docx?