|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.ooffice.TextFrame
public class TextFrame
simplifies the handling of OpenOffice Writer documents This class implements ThirdParty for its use of OpenOffice libraries; see www.openoffice.org
| Nested Class Summary | |
|---|---|
static class |
TextFrame.AnchorType
|
| Constructor Summary | |
|---|---|
TextFrame()
creates a blank new document |
|
TextFrame(File template)
creates a new document based on the given template file |
|
TextFrame(File file,
Map<Object,Object> props)
loads a document (the given file) into a blank frame along with the given properties |
|
TextFrame(String url,
Map<Object,Object> props)
loads a document from the given url into a blank frame along with the given properties. |
|
| Method Summary | |
|---|---|
void |
close()
closes and disposes the document |
static TextFrame |
getActiveDocument()
seeks the currently active document on the desktop (if any) and returns it |
com.sun.star.text.XTextCursor |
getBookmarkCursor(String bookmark)
|
com.sun.star.text.XTextRange |
getBookmarkRange(String bookmark)
|
String[] |
getBookmarks()
|
String |
getBookmarkText(String bookmark)
|
static String |
getDefaultFileExtension()
|
com.sun.star.text.XTextDocument |
getDocument()
|
String[] |
getFieldNames()
|
String |
getFieldText(String fieldName)
the fully quantified field name is to be supplied |
String[] |
getUserFieldNames()
|
String |
getUserFieldText(String userFieldName)
|
com.sun.star.text.XTextViewCursor |
getViewCursor()
returns the XTextCursor that is currently visible in the document |
com.sun.star.text.XTextViewCursor |
gotoBookmark(String bookmark)
sets the view cursor to the given bookmark |
com.sun.star.text.XTextCursor |
gotoFirst(String searchText,
boolean caseSensitive)
sets the view cursor to the first occurrence of the given String and returns it as a cursor for further handling |
void |
insertFileAt(File file,
com.sun.star.text.XTextCursor cursor)
inserts one document into another |
void |
insertImage(File file,
com.sun.star.text.XTextCursor cursor,
TextFrame.AnchorType at,
Map<Object,Object> props)
props may be null |
void |
insertImage(String url,
com.sun.star.text.XTextCursor cursor,
TextFrame.AnchorType at,
Map<Object,Object> props)
props may be null |
void |
insertUrlAt(String url,
com.sun.star.text.XTextCursor cursor)
inserts one document into another |
void |
print()
|
void |
print(String printerName)
|
void |
replaceAll(String search,
String replace)
performs a simple search/replace on the entire document |
void |
setBookmarkText(String bookmark,
String text)
sets the text of for a defined bookmark within the given document |
void |
setFieldText(String fieldName,
String text)
the fully quantified field name is to be supplied |
void |
setUserFieldContent(Map<Object,Object> fields)
sets the field content of the field variables contained in the map. |
void |
storeTo(File file,
boolean representNewLocation)
saves the embedded document to the given file (overwriting it, if it exists) |
void |
storeTo(File file,
String filterName,
boolean representNewLocation)
saves the given document to the given file (overwriting it, if it exists) in the given format |
void |
storeTo(String url,
boolean representNewLocation)
saves the given document to the given url (overwriting the url if it exists) |
void |
storeTo(String url,
String filterName,
boolean representNewLocation)
allows to specify a filterName that defines the output format (null is allowed). |
com.sun.star.text.XTextCursor |
writeText(String text,
com.sun.star.text.XTextCursor cursor)
writes text directly into the frame at the given cursor position; the cursor is returned for further handling |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TextFrame()
throws OfficeException
OfficeException
public TextFrame(File template)
throws OfficeException,
IOException
OfficeException
IOException
public TextFrame(File file,
Map<Object,Object> props)
throws OfficeException,
IOException
OfficeException
IOException
public TextFrame(String url,
Map<Object,Object> props)
throws OfficeException,
IOException
OfficeException
IOException| Method Detail |
|---|
public static TextFrame getActiveDocument()
throws OfficeException
OfficeExceptionpublic com.sun.star.text.XTextDocument getDocument()
public static String getDefaultFileExtension()
public void storeTo(File file,
boolean representNewLocation)
throws IOException
IOException
public void storeTo(File file,
String filterName,
boolean representNewLocation)
throws IOException
IOException
public void storeTo(String url,
boolean representNewLocation)
throws IOException
IOException
public void storeTo(String url,
String filterName,
boolean representNewLocation)
throws IOException
IOException
public void close()
throws IOException
close in interface CloseableIOException
public void print()
throws OfficeException
OfficeException
public void print(String printerName)
throws IllegalArgumentException
IllegalArgumentExceptionpublic com.sun.star.text.XTextViewCursor getViewCursor()
public com.sun.star.text.XTextCursor gotoFirst(String searchText,
boolean caseSensitive)
throws OfficeException
OfficeException
public com.sun.star.text.XTextViewCursor gotoBookmark(String bookmark)
throws OfficeException
OfficeException
public com.sun.star.text.XTextCursor writeText(String text,
com.sun.star.text.XTextCursor cursor)
public void replaceAll(String search,
String replace)
public com.sun.star.text.XTextRange getBookmarkRange(String bookmark)
throws OfficeException
OfficeException
public com.sun.star.text.XTextCursor getBookmarkCursor(String bookmark)
throws OfficeException,
IllegalArgumentException
OfficeException
IllegalArgumentExceptionpublic String[] getBookmarks()
public String getBookmarkText(String bookmark)
throws OfficeException,
IllegalArgumentException
OfficeException
IllegalArgumentException
public void setBookmarkText(String bookmark,
String text)
throws OfficeException,
IllegalArgumentException
IllegalArgumentException - if the bookmark is unknown in this document
OfficeException
public void insertFileAt(File file,
com.sun.star.text.XTextCursor cursor)
throws OfficeException,
IllegalArgumentException
OfficeException
IllegalArgumentException
public void insertUrlAt(String url,
com.sun.star.text.XTextCursor cursor)
throws OfficeException,
IllegalArgumentException
OfficeException
IllegalArgumentExceptionpublic String[] getFieldNames()
public void insertImage(File file,
com.sun.star.text.XTextCursor cursor,
TextFrame.AnchorType at,
Map<Object,Object> props)
throws OfficeException
OfficeException
public void insertImage(String url,
com.sun.star.text.XTextCursor cursor,
TextFrame.AnchorType at,
Map<Object,Object> props)
throws OfficeException,
IllegalArgumentException
OfficeException
IllegalArgumentExceptionpublic String[] getUserFieldNames()
public String getFieldText(String fieldName)
throws OfficeException,
IllegalArgumentException
OfficeException
IllegalArgumentException
public String getUserFieldText(String userFieldName)
throws OfficeException,
IllegalArgumentException
OfficeException
IllegalArgumentException
public void setFieldText(String fieldName,
String text)
throws OfficeException,
IllegalArgumentException
OfficeException
IllegalArgumentException
public void setUserFieldContent(Map<Object,Object> fields)
throws OfficeException
fields - maps field names to the content that is to be used for the key field name
OfficeException
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||