-
Notifications
You must be signed in to change notification settings - Fork 6
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
Word/DOCX-Eport as ZMS-Action applying python-docx #288
Conversation
The notebook evaluates a function add_htmlblock_to_docx() for converting richtext to docx-objects. Hint: the current code handles only 2 levels of html children. |
Hints for b5c37c0 Certain layout/style properties cannot be added by docx-API, here some helper functions are needed using the XML-API and adding generic opendocument-xml objects:
|
@zmsdev for discussion: 7b8517a A class method TASK: JSONify mix of paragraphs (block) and runs (inline)This JSON model is obviously too flat for dealing with inline formatting. The object's content block need to be segmented into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python-docx still does not support external hyperlinks
So a function is needed for creating the hyperlink run element:
Hint: the docx-template (styles.xml) is massivly reduced and now contains only code-relevant styles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the jupyter prototype
https://github.com/zms-publishing/ZMS/blob/16b024f4865c26a321acd12ed7d8ce366aaa79fb/docs/notebooks/snippets_11_pythondocx_table%20.ipynb
the table processing now takes a different appoach:
- create a 2D list of cell contents, apply cell content as html-string. after adding a grid-coords-prefix (see image below) fill identical content to row/col-spanned cells
- fill the docx-table grid and merge cells with identical content in 2 dimensions
- convert cell-wise html-content to docx-content
Actually this approach is quite stable in respect to cell-merging.
Hint: an initial empty run element in a paragraph suppresses its list/numbering properties
…st restart (in progress)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ref: #287