|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.poi.hpsf.examples.WriteAuthorAndTitle
public class WriteAuthorAndTitle
This class is a sample application which shows how to write or modify the author and title property of an OLE 2 document. This could be done in two different ways:
The first approach is to open the OLE 2 file as a POI filesystem
(see class POIFSFileSystem
), read the summary information property
set (see classes SummaryInformation
and PropertySet
), write
the author and title properties into it and write the property set back into
the POI filesystem.
The second approach does not modify the original POI filesystem, but instead creates a new one. All documents from the original POIFS are copied to the destination POIFS, except for the summary information stream. The latter is modified by setting the author and title property before writing it to the destination POIFS. It there are several summary information streams in the original POIFS - e.g. in subordinate directories - they are modified just the same.
This sample application takes the second approach. It expects the name of the existing POI filesystem's name as its first command-line parameter and the name of the output POIFS as the second command-line argument. The program then works as described above: It copies nearly all documents unmodified from the input POI filesystem to the output POI filesystem. If it encounters a summary information stream it reads its properties. Then it sets the "author" and "title" properties to new values and writes the modified summary information stream into the output file.
Further explanations can be found in the HPSF HOW-TO.
Constructor Summary | |
---|---|
WriteAuthorAndTitle()
|
Method Summary | |
---|---|
static void |
main(java.lang.String[] args)
Runs the example program. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WriteAuthorAndTitle()
Method Detail |
---|
public static void main(java.lang.String[] args) throws java.io.IOException
Runs the example program.
args
- Command-line arguments. The first command-line argument must
be the name of a POI filesystem to read.
java.io.IOException
- if any I/O exception occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |