Skip to content
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

Switch to phpoffice/phpword #58

Closed
maxime-rainville opened this issue Sep 13, 2023 · 3 comments
Closed

Switch to phpoffice/phpword #58

maxime-rainville opened this issue Sep 13, 2023 · 3 comments

Comments

@maxime-rainville
Copy link

maxime-rainville commented Sep 13, 2023

docvert is old and unmaintained. phpoffice/phpword provides better support and can be used without installing other libs on the server.

Acceptance criteria

  • documentconverter uses phpoffice/phpword by default to convert document to WYSIWYG content
  • Table and headers are retained. Other style element are a bonus.
  • If any API are inherent to docvert, they are deprecated.
  • phpoffice is used by default and projects can choose to keep using docvert.
  • Additional import options that do not work are removed. (Added during second refinement session)

PRs

@maxime-rainville
Copy link
Author

I'm really not sure about that last ACs. I'm personally happy to just let go of docvert if phpoffice/phpword does everything it does.

@emteknetnz
Copy link
Member

emteknetnz commented Sep 19, 2023

All the checkboxes etc in CMS 4/5 version of document converter simply don't work as intended - checkboxes etc being everything above the upload field

image

They're not included in the POST request that's sent to the server when you select a file in the ImportField (subclass on UploadField)

I've tried in on CMS 3 and I get this post request when I select a file:

CMS 3:

Extra data gets attached via jquery via https://github.com/silverstripe/silverstripe-documentconverter/blob/1/javascript/DocumentImportField.js#L36

-----------------------------37746332813277979752999189326
Content-Disposition: form-data; name="SecurityID"

87f0b1d119b923ebeb6c51c663f20ece7d07f819
-----------------------------37746332813277979752999189326
Content-Disposition: form-data; name="ID"

3
-----------------------------37746332813277979752999189326
Content-Disposition: form-data; name="SplitHeader"

0
-----------------------------37746332813277979752999189326
Content-Disposition: form-data; name="KeepSource"

0
-----------------------------37746332813277979752999189326
Content-Disposition: form-data; name="ChosenFolderID"


-----------------------------37746332813277979752999189326
Content-Disposition: form-data; name="PublishPages"

0
-----------------------------37746332813277979752999189326
Content-Disposition: form-data; name="IncludeTOC"

0
-----------------------------37746332813277979752999189326
Content-Disposition: form-data; name="ImportedFromFile"; filename="sample-word2007.docx"
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

<lots of data for the word doc>

CMS 4/5:

At some point it might have attached via jquery if there was ever a jquery file uploader in CMS 4 (I don't know the full history of it), though it no longer does https://github.com/silverstripe/silverstripe-documentconverter/blob/2/javascript/DocumentConversionField.js#L36 - simply the react uploadfield doesn't trigger jquery handlers. The onfileuploadsubmit handler maps to fileuploadsubmit in jquery.fileupload which we obviously don't use anymore

Also the div.documentimport selector doesn't work in CMS 4/5, I had to manually add $this->addExtraClass('documentimport'); to SettingsField.php in order for it to show - I think this class was automatically added in CMS 3 since I can't match on string search in the codebase

-----------------------------27793481942264258619221807136
Content-Disposition: form-data; name="SecurityID"

2e2ded4a3b5a0f741be33c99fd0942947bdde7ac
-----------------------------27793481942264258619221807136
Content-Disposition: form-data; name="ParentID"

1
-----------------------------27793481942264258619221807136
Content-Disposition: form-data; name="Upload"; filename="sample-word2007.docx"
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

<lots of data for the word doc>

@maxime-rainville
Copy link
Author

We've decided not to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants