Accessing View Data: XViewDataSupplier


Using OOo, open a document, edit it or change something (for example, move to another page or change the zoom factor), close the document, and open the document again. When you do this, the document opens at the same screen location, at the same size , with the same zoom factor as was active when it was last saved. This information is stored with the document and is available through the interface com.sun.star.document.XViewDataSupplier. This interface provides one object method, getViewData(). Listing 8 displays the view data for ThisComponent (see Figure 5 ).


Figure 5: View data for a document.
Listing 8: GetViewData is found in the Generic module in this chapter's source code files as SC12.sxw.
start example
 Sub GetViewData   Dim vViewData 'View data object   Dim i%        'Index variable   Dim j%        'Index variable   Dim s$        'General string   Dim vtemp     'View data for one object   vViewData = ThisComponent.getViewData()   REM For each view of the data   For i = 0 To vViewData.getCount() - 1     vtemp = vViewData.getByIndex(i)     For j = 0 To UBound(vtemp)       s = s & vtemp(j).Name & " = " & CStr(vtemp(j).Value) & CHR$(10)     Next     MsgBox s, 0, "View Data"   Next End Sub 
end example
 



OpenOffice.org Macros Explained
OpenOffice.org Macros Explained
ISBN: 1930919514
EAN: 2147483647
Year: 2004
Pages: 203

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net