How to access annotation (comment) objects inserted into Draw pages by user code?

The subject tells it all.
(Don’t actually need, but want to know.)

Hello, Wolfgang!
Where are the pitfalls here? :slight_smile:

Sub Test
  Dim dp As Object, oEnum As Object, oAnn as Object, i As Long
  dp=ThisComponent.DrawPages(0)
  oEnum=dp.createAnnotationEnumeration()
  Do While oEnum.hasMoreElements()
    oAnn=oEnum.nextElement()
    i=i+1
  Loop  
  Msgbox "Annotations: " & i 
End Sub

(This is not about the working - where also things are strange - but …)
As is the case with pitfalls: you can’t see them if you don’t already know where they are.
How did you find that interface XAnnotationEnumeration ?
It’s not addressed by any service or interface I would think of when searching the API reference. And even if you got a hint by @Sokol92, there is not any useful internal reference to API objects, and the single enumerated annotation doesn’t even have an ImplementationID. It’s crazy in my eyes.
Well, we should discuss this in detail when we’re sitting side by side in front of a computer screen in Belgorod or Munich next time.

1 Like