Apache OpenOffice (AOO) Bugzilla – Issue 116909
PageCount (DocumentStatistics) via Macro is not correct
Last modified: 2017-05-20 11:20:07 UTC
steps to reproduce: - open new writer document - run macro provided below - result: "PageCount" (DocumentStatistics) is not correct, it shows "0" instead of "1" - open File - Properties - "Statistics" - run macro again - result is "1" now ... Sub Test() MsgBox getPageCount(ThisComponent) & Chr(13) & ThisComponent.getCurrentController().PageCount End Sub Function getPageCount(oDoc) oProps = oDoc.getDocumentProperties() aStats = oProps.DocumentStatistics for i = uBound(aStats) to 0 step -1 x = aStats(i) if x.Name = "PageCount" then exit for next getPageCount = 0 if i > -1 then getPageCount = x.Value End Function
Reassigned
MRU->OS: reproducible in 300m99. The page count via Macro will only be correct after the File.properties.statistics tab page has been opened.
There is a better way to force document formatting and get the current value of PageCount and LineCount. MsgBox("Page Count = " & ThisComponent.CurrentController.PageCount) See service c.s.s.text.TextDocumentView
Reset assigne to the default "issues@openoffice.apache.org".