Open
Conversation
giurul
reviewed
May 15, 2023
giurul
left a comment
There was a problem hiding this comment.
Can you use this to recreate a real line break?
try:
self.run.add_break()
except AttributeError: #If <br> is the first element parsed, self.run will not be defined
self.paragraph = self.doc.add_paragraph()
self.run = self.paragraph.add_run()
self.run.add_break()
Author
Yes, you could add a line break in that way. However, adding the paragraph itself creates a new line and so you would end up with the appearance of two new lines, I believe. |
giurul
added a commit
to giurul/html2docx
that referenced
this pull request
May 16, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(Issue #37)
When the HTML to parse begins with a
<br>tag, an error is thrown because self.run is not defined. This is a simple fix to handle the error.