Iterationen
Im nachstehenden Code wird gezeigt, wie man durch offene Dokumente iteriert.
01 // Iterate through all open documents and set the View mode to 'Browser'.
02 for (Document doc:authenticDesktop.getDocuments())
03 if ( doc.getCurrentViewMode() != SPYViewModes.spyViewBrowser)
04 doc.switchViewMode(SPYViewModes.spyViewBrowser);
05
06 // An alternative iteration mode is index-based. COM indices are typically zero-based.
07 Documents documents = authenticDesktop.getDocuments();
08 for (int i = 1; i <= documents.getCount(); i++)
09 {
10 Document doc = documents.getItem(i);
11 ...
12 }