The Free and Open Productivity Suite
Follow us on Twitter: @ApacheOO

Utility Scripts contributed by the OpenOffice.org community

This page contains downloads of utility scripts that have been contributed by the OpenOffice.org community. These scripts are intended to demonstrate how to write Java (or the dynamically-typed Beanshell) scripts for OpenOffice, with full access to both the OpenOffice.org API and the Java APIs. The scripts are for use with the Early Developer Release 0.3 of the Office Scripting Framework and all subsequent releases.

Pre-requisites

General Installation Procedure

Available Scripts

Word Count

Author: Duncan Foster
Aim: Provides a simple word count of the selected text.
Language: BeanShell
Pre-requisites: none
Download:  WordCount.zip (2Kb)
Installation: no additional steps needed
Description: Uses the OpenOffice API to get the selected text, and then uses Java's StringTokenizer (using the default delimiters) to obtain a word count. Displays the result in a simple Swing dialog.
Issues: none

Top

Capitalisation

Author: Duncan Foster
Aim: Converts the selected text from upper case to first letter upper case, rest lower case, to lower case.
Language: BeanShell
Pre-requisites: none
Download:  Capitalise.zip (2Kb)
Installation: no additional steps needed
Description: Uses the OpenOffice API to get the selected text (or makes a selection of the current word if no text selected), and then uses Java to change the case. Rotates from "THIS" -> "This" -> "this" -> "THIS". The script attempts to break up selected text into sentences using the Java StringTokenizer. The script also attempts to maintain the selection.
Issues: The script fails to maintain the selection if two separate areas of text are selected. For example, if the first and last words of the previous sentence were selected, only one (undefined) would remain selected after the script has been run.
Top

Post to Newsgroups

Author: Neil Montgomery
Aim: Facilitates the posting of an OpenOffice document to a newsgroup.
Language: Java
Pre-requisites: none
Download: Newsgroup.zip (540Kb)
Installation: no additional steps needed
Description:  The script will detect if a local installation of either Netscape or Mozilla has been used to subscribe to any newsgroups. These newsgroups will be listed for the user in a combo box. If no newsgroups are detected the user must supply the name of the newgroup and server. The user may also supply the reply-to address, subject and message body (in the comment text field). The user can also specify the format in which to send the attached document (the currently active document). If the document hasn't already been saved with a title, then the default name for the attachment(s) will be "Attachment.sxw" and/or "Attachment.html".
Issues: none.
Top

Scripting Framework Issuezilla Query -> Writer

Author: John Rice
Aim: Outputs the results of an Issuezilla query into the open Writer document.
Language: BeanShell
Pre-requisites: none
Download: SFBugsQueryIssuezilla.zip (2Kb)
Installation: The script sets a HTTP proxy on lines 43,44. The user will need to modify or remove these according to their local settings. The script also contains a certain amount of debug output which the user may want to remove.
Description:  The script uses Java to open a HTTP connection to the OpenOffice.org website, passing a URL for an Issuezilla query for Scripting Framework bugs. The script then writes summary information for each bug into the open Writer document.
Issues: none.
Top

Scripting Framework Issuezilla Query -> Calc

Author: John Rice
Aim: Outputs the results of an Issuezilla query into the open Calc document.
Language: BeanShell
Pre-requisites: none
Download: SFBugsQueryIssuezillaCalc.zip (2Kb)
Installation: The script sets a HTTP proxy on lines 25,26. The user will need to modify or remove these according to their local settings.
Description:  The script uses Java to open a HTTP connection to the OpenOffice.org website, passing a URL for an Issuezilla query for Scripting Framework bugs. The script then writes summary information for each bug into the open Calc document.
Issues: none.
Top

Insert Copyright Symbol

Author: Duncan Foster
Aim: Inserts a copyright symbol (or replaces the current selection with a copyright symbol).
Language: Beanshell
Pre-requisites: none
Download: InsertC.zip (4Kb)
Installation: No additional steps needed.
Description: Inserts a copyright symbol (or replaces the current selection with a copyright symbol).
Issues: None.
Top

Insert Trademark Symbol

Author: Duncan Foster
Aim: Inserts a trademark symbol (or replaces the current selection with a trademark symbol).
Language: Beanshell
Pre-requisites: none
Download: InsertTM.zip (4Kb)
Installation: No additional steps needed.
Description: Inserts a trademark symbol (or replaces the current selection with a trademark symbol).
Issues: None.
Top

Insert Hidden Text

Author: Duncan Foster
Aim: Inserts a hidden text field
Language: Beanshell
Pre-requisites: none
Download: InsertHiddenText.zip (4Kb)
Installation: No additional steps needed.
Description: Replaces the currently selected text with a hidden text field with the same contents.
Issues: None.
Top

Export To HTML

Author: John Rice
Aim: Saves a copy of the document in HTML format.
Language: Beanshell
Pre-requisites: none
Download: ExportToHTML.zip (4Kb)
Installation: No additional steps needed.
Description: Saves a copy of the document in the user's home directory in HTML format. Does not change the type of the current document (as happens with "Save As").
Issues: None.
Top

Combined Utilities

Aim: A zip file containing all of the scripts above.
Download: all.zip (550Kb)

Top


Last Modified: Fri Jun 20 15:28:18 BST 2003

Apache Software Foundation

Copyright & License | Privacy | Website Feedback | Contact Us | Donate | Thanks

Apache, the Apache feather logo, and OpenOffice are trademarks of The Apache Software Foundation. OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.