Difference between revisions of "API/Samples/StarBasic/ListOfFilterName"
From Apache OpenOffice Wiki
(New page: Description: To get a list of Filter Name in OpenOffice.org 2.3, the property of Filter Name used to importand export has to be exactly matched the name in the list. This snippet will open...) |
|||
Line 25: | Line 25: | ||
End Sub | End Sub | ||
</source> | </source> | ||
+ | [[Category:API]] | ||
+ | [[Category:Samples]] | ||
+ | [[Category:StarBasic]] | ||
+ | [[Category:Office]] |
Revision as of 02:16, 10 March 2008
Description: To get a list of Filter Name in OpenOffice.org 2.3, the property of Filter Name used to importand export has to be exactly matched the name in the list. This snippet will open a new ODT document and append the list to the document.
REM ***** BASIC ***** Sub Main oFF = createUnoService( "com.sun.star.document.FilterFactory" ) oFilterNames = oFF.getElementNames() ' Now print the filter names. ' For i = LBound( oFilterNames ) To UBound( oFilterNames ) ' Print oFilterNames(i) ' Next ' Create a Writer doc and save the filter names to it. oDoc = StarDesktop.loadComponentFromURL( "private:factory/swriter", "_blank", 0, Array() ) oText = oDoc.getText() oCursor = oText.createTextCursor() oCursor.gotoEnd( False ) ' Print the filter names into a Writer document. For i = LBound( oFilterNames ) To UBound( oFilterNames ) oText.insertString( oCursor, oFilterNames(i), False ) oText.insertControlCharacter( oCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False ) Next End Sub