Moved text in tracked changes is duplicated when using paragraph.raw_text()
#794
Labels
bug
Something isn't working
paragraph.raw_text()
#794
Description
When calling
paragraph.raw_text()
on aParagraph
with changes that are not yet accepted, the expected behavior in to see the paragraph’s text as if all the tracked changes had been accepted. But tracked changes corresponding to a "move" operation are duplicated.Steps to reproduce
paragraph.raw_text()
-> output gives the same 2 linesExpected behavior
The second line should not be printed twice.
## Suggestion
A moved element in a docx file corresponds to a "w:moveFrom" followed by a "w:moveTo" element in the document.xml
IMO, those XML elements should be added to the
XMLElement
andParagraphChild
enums. This requires a bit of refactor. Then, theraw_text
method fromParagraph
should be added a new match arm for theParagraphChild::MoveTo
case, which would print the Run’s text.I’ve made a quick fix myself for my needs, I will submit a PR soon with my changes. The fix seems to solve the problem for my very precise needs, but it is definitely not enough for it to be accepted and it needs some more work. It also adds quite a lot of duplicate code, so there is probably a better way to achieve it using Traits.
Desktop
The text was updated successfully, but these errors were encountered: