Skip to content
This repository

Fix issue #120 #121

Closed
wants to merge 2 commits into from

1 participant

peterdemin
peterdemin

... wrong page numbers)

Issue: #120

I added cycle to update indexes two times.

peterdemin Fixing Issue #120 (When converting odt to pdf table of contents may h…
…ave wrong page numbers)

Issue: dagwieers#120

I added cycle to update indexes two times.
2680c53
peterdemin

Actually, I found out, that I fixed this wrong. Will make another pull request.

peterdemin Fixing fix for issue #120
indexes.getByIndex(i).update() must be called second time
after second call to
    document.refresh()
    indexes = document.getDocumentIndexes()
af458eb
peterdemin peterdemin closed this April 05, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Mar 18, 2013
peterdemin Fixing Issue #120 (When converting odt to pdf table of contents may h…
…ave wrong page numbers)

Issue: dagwieers#120

I added cycle to update indexes two times.
2680c53
Apr 05, 2013
peterdemin Fixing fix for issue #120
indexes.getByIndex(i).update() must be called second time
after second call to
    document.refresh()
    indexes = document.getDocumentIndexes()
af458eb
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 14 additions and 10 deletions. Show diff stats Hide diff stats

  1. 24  unoconv
24  unoconv
@@ -867,16 +867,20 @@ class Convertor:
867 867
 
868 868
             ### Update document indexes
869 869
             phase = "update-indexes"
870  
-            try:
871  
-                document.refresh()
872  
-                indexes = document.getDocumentIndexes()
873  
-            except AttributeError:
874  
-                # the document doesn't implement the XRefreshable and/or
875  
-                # XDocumentIndexesSupplier interfaces
876  
-                pass
877  
-            else:
878  
-                for i in range(0, indexes.getCount()):
879  
-                    indexes.getByIndex(i).update()
  870
+            for ii in range(2):
  871
+                # At first update Table-of-Contents.
  872
+                # ToC grows, so page numbers grows too.
  873
+                # On second turn update page numbers in ToC.
  874
+                try:
  875
+                    document.refresh()
  876
+                    indexes = document.getDocumentIndexes()
  877
+                except AttributeError:
  878
+                    # the document doesn't implement the XRefreshable and/or
  879
+                    # XDocumentIndexesSupplier interfaces
  880
+                    break
  881
+                else:
  882
+                    for i in range(0, indexes.getCount()):
  883
+                        indexes.getByIndex(i).update()
880 884
 
881 885
             info(1, "Selected output format: %s" % outputfmt)
882 886
             info(2, "Selected office filter: %s" % outputfmt.filter)
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.