Hello,
Thank you for your letter. In your code, "firstdoc" is the original document that was not modified at the beginning, and "second.doc" is the document that has been modified with Strikeout? If so, I simulated the attached documents, when testing the following code, I did find that the Strikeout effect was not compared correctly. I logged this issue into our tracking system with SPIREDOC-11070. Our Dev team will further investigate and fix it.
- Code: Select all
from spire.doc.common import *
from spire.doc import *
doc1 = Document()
doc1.LoadFromFile("firstdoc.docx")
doc2 = Document()
doc2.LoadFromFile("second_doc.docx")
# Set CompareOptions
compareOptions = CompareOptions()
compareOptions.IgnoreFormatting = False
# Compare the contents of the two documents
doc1.Compare(doc2, "E-iceblue", DateTime.get_Now(), compareOptions)
# Specify the output file name for the compared result
result = "result12.docx"
# Save the compared result to the specified file path in Docx2013 format
doc1.SaveToFile(result, FileFormat.Docx2013)
However, when testing below code, the effect is correct. Please confirm if this is consistent with your test results. If there are any differences, please provide a detailed information and your testing documents for further verification.
- Code: Select all
from spire.doc.common import *
from spire.doc import *
doc1 = Document()
doc1.LoadFromFile("firstdoc.docx")
doc2 = Document()
doc2.LoadFromFile("second_doc.docx")
# Set CompareOptions
compareOptions = CompareOptions()
compareOptions.IgnoreFormatting = False
# Compare the contents of the two documents
doc2.Compare(doc1, "E-iceblue", DateTime.get_Now(), compareOptions)
# Specify the output file name for the compared result
result = "result21.docx"
# Save the compared result to the specified file path in Docx2013 format
doc2.SaveToFile(result, FileFormat.Docx2013)
Sincerely,
Lisa
E-iceblue support team
Login to view the files attached to this post.