Spire.Doc for Python 12.3.2 supports getting revisions

2024-03-20 09:07:00

We are pleased to announce the release of Spire.Doc for Python 12.3.2. This version supports getting revisions. It also fixes the issue that the program threw a "TypeError" error when the keyword was not matched using FindString(). More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREDOC-10366 Supports getting revisions.
doc1 = Document(inputFile_1)
doc2 = Document(inputFile_2)
doc1.Compare(doc2, "Author")
revisions = DifferRevisions(doc1)
content = ""
m = 0
n = 0
insertRevisionList = revisions.InsertRevisions
deleteRevisionList = revisions.DeleteRevisions
for i in range(0, insertRevisionList.__len__()):
    # if isinstance(insertRevisionList[i], TextRange):
    if insertRevisionList[i].DocumentObjectType == DocumentObjectType.TextRange:
          m += 1
          textRange = TextRange(insertRevisionList[i])
          content += "insert #" + m.__str__() + ":" + textRange.Text + '\n'        content += "=====================" + '\n'
for i in range(0, deleteRevisionList.__len__()):
    # if isinstance(deleteRevisionList[i], TextRange):
    if deleteRevisionList[i].DocumentObjectType == DocumentObjectType.TextRange:
           n += 1
           textRange = TextRange(deleteRevisionList[i])
           content += "delete #" + n.__str__() + ":" + textRange.Text + '\n'        content += "=====================" + '\n'
New feature SPIREDOC-10350 Supports TextSelection.GetAsRange(), TextSelection.GetRanges() and TextSelection.GetAsRange(true) methods.
document = Document()
document.LoadFromFile(inputFile)
textSelections = document.FindAllString("word", False, True)
for selection in textSelections:
    selection.GetAsRange();
    selection.GetRanges();
    selection.GetAsRange(true);
Bug SPIREDOC-10344 Fixes the issue that the program threw a "TypeError" error when the keyword was not matched using FindString().
Click the link below to download Spire.Doc for Python 12.3.2: