Skip to content

Support PhpWordOutput format #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 27 commits into from

Conversation

sevjan
Copy link

@sevjan sevjan commented May 20, 2022

In our enviroment we often use the PhpOffice/PhpWord library. With a Office Word ouput the user has more flexiblity to change the document afterwards. With the existing Html/Pdf outputs we could not achive that. (An option would have been with ImageMagick to render a TCPDF, convert it to PNG, cut out the payment part and add it to the word document. But the drawback would haven been to require all the ImageMagick stuff and to install the extesion.)

Therefore I added a PhpWordOutput version. I have tried to follow best practices as much as possible and to meet the code style. If I missunderstood something please let me know to correct it.
For exacte position I hade to use some ugly nested tables. But if nothing is to be changed in the QR invoice part anyway, it shouldn't matter.

Of course, this output is a slightly different one because it can be edited afterwards due to the Office Word format. So I could understand if you don't want to have this kind of export in the core library.

If you need any further information or test for this PR just let me know.
And don't forget for my first PR

Be nice to each other.

sevjan added 24 commits May 17, 2022 10:55
Comparing the unzip files is necessary. Two word documents are only the same if they are generated exactly at the same timestamp. (This might be caused by the zip algorithm or some other word file config that can not be manipulated by the PhpWord library.) Therefore, the unzipped content gets compared.
Replace the element type with the generic text element. Use a static style provider to get the current text style (value, amount, currency, further information).
@sevjan sevjan changed the title Pr for php word output Support PhpWordOutput format May 20, 2022
sevjan added 3 commits May 20, 2022 14:41
…eeded.

The placeholder is already hardcoded by a switch for the different payment parts.
@sprain
Copy link
Owner

sprain commented May 20, 2022

Hey @sevjan – thank you for the pull request. Interesting application that I would not have thought of :) I will gladly have a look at this pr as soon as I find the time to do so.

@sprain sprain added the waiting-for-review Waiting for review by maintainer label May 20, 2022
@sprain
Copy link
Owner

sprain commented May 23, 2022

I had a first look. This seems a nice implementation. There are two things we need to have a closer look:

If you allow me to edit this branch, I can help working on it without needing to open a new pr.

@sprain sprain added needs-work This pr needs some more work to be ready and removed waiting-for-review Waiting for review by maintainer labels May 23, 2022
@sevjan
Copy link
Author

sevjan commented May 23, 2022

Thank you for your prompt reply.
That sounds good. Of course you can edit this branch. (If I see it right you already can.)

  1. Locally the test run fine (on Windows 10 / PHP 8.0). I have chosen a similar comparison like tcpdf/fpdf but for the PhpWord I needed in addition to extract the .docx files with \ZipArchive. The chunk_split was just for better comaprison on to long one liner.
  2. Unfortunately, I can not test on +8.1.0 at the moment. If you can fix that, that would be great.

@sprain
Copy link
Owner

sprain commented May 29, 2024

Closing due to inactivity and obviously missing demand.

@sprain sprain closed this May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-work This pr needs some more work to be ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants