|
xelem.3.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Workbook
Represents the Workbook element, the root of a SpreadsheetML document.
Creating SpreadsheetML and Excel workbooks from within Java starts here.
Besides adding child XLElements and setting other features,
the Workbook can be used to merge Styles.
After finishing the Workbook you'll probably want to create the
Document
, the structure that holds this Workbook
and all of it's children. This is done with the
createDocument()
-method.
A Workbook might also be obtained from an
ExcelReader
,
an object that reads Excel xml-files or xml-InputSources.
Field Summary |
---|
Fields inherited from interface nl.fountain.xelem.excel.XLElement |
---|
PREFIX_HTML, PREFIX_O, PREFIX_SS, PREFIX_X, XMLNS, XMLNS_HTML, XMLNS_O, XMLNS_SS, XMLNS_X |
Method Summary | |
---|---|
NamedRange |
addNamedRange(NamedRange namedRange)
Adds a new NamedRange to this workbook. |
NamedRange |
addNamedRange(String name,
String refersTo)
Adds a new NamedRange to this workbook. |
Worksheet |
addSheet()
Adds a new Worksheet to this workbook. |
Worksheet |
addSheet(String name)
Adds a new Worksheet to this workbook with the given name as name. |
Worksheet |
addSheet(Worksheet sheet)
Adds the given Worksheet to this workbook. |
void |
appendInfoSheet()
Appends a Worksheet with general information to this Workbook. |
Document |
createDocument()
Creates a Document , the structure that holds this Workbook
and all of it's children. |
DocumentProperties |
getDocumentProperties()
Gets the DocumentProperties of this workbook. |
ExcelWorkbook |
getExcelWorkbook()
Gets the ExcelWorkbook of this workbook. |
String |
getFileName()
Gets the filename of this Workbook. |
String |
getName()
Gets the name of this Workbook. |
Map<String,NamedRange> |
getNamedRanges()
Gets all the NamedRanges that were added to this workbook. |
List<String> |
getSheetNames()
Gets a list of all the names of worksheets in this workbook in display order. |
List<String> |
getWarnings()
Gets a list of warnings (Strings) that were registered during assembly of this workbook after a call to createDocument() . |
Worksheet |
getWorksheet(String name)
Gets the worksheet with the given name. |
Worksheet |
getWorksheetAt(int index)
Gets the worksheet at the given index. |
List<Worksheet> |
getWorksheets()
Gets a list of all the worksheets in this workbook in display order. |
boolean |
hasDocumentProperties()
Specifies whether this workbook has DocumentProperties. |
boolean |
hasExcelWorkbook()
Specifies whether this workbook has an ExcelWorkbook. |
boolean |
isPrintingDocComments()
Specifies whether this Workbook's createDocument() -method
will include docComments. |
boolean |
isPrintingElementComments()
Specifies whether this Workbook's createDocument() -method
will include comments. |
void |
mergeStyles(String newID,
String id1,
String id2)
Merges two SpreadsheetML Style elements. |
Worksheet |
removeSheet(String name)
Removes the sheet with the given name. |
void |
setDocumentProperties(DocumentProperties docProps)
Set the DocumentProperties of this workbook or, if this workbook allready had DocumentProperties, replace it. |
void |
setExcelWorkbook(ExcelWorkbook excelWb)
Set the ExcelWorkbook of this workbook or, if this workbook allready had an ExcelWorkbook, replace it. |
void |
setFileName(String filename)
Sets the filename of this Workbook. |
void |
setName(String name)
Sets the name of this Workbook. |
void |
setPrintDocComments(boolean print)
Sets whether this Workbook's createDocument() -method
will include docComments. |
void |
setPrintElementComments(boolean print)
Sets whether this Workbook's createDocument() -method
will print comments which were set with
XLElement.addElementComment(String) . |
Methods inherited from interface nl.fountain.xelem.excel.XLElement |
---|
addElementComment, assemble, getElementComments, getNameSpace, getPrefix, getTagName, setAttributes, setChildElement |
Method Detail |
---|
void setName(String name)
String getName()
void setFileName(String filename)
String getFileName()
setFileName(String)
the name of the workbook is returned
with the extension '.xls'.
void mergeStyles(String newID, String id1, String id2) throws UnsupportedStyleException
newID
- the ss:ID of the new merged styleid1
- the ss:ID of the copied styleid2
- the ss:ID of the appended style
UnsupportedStyleException
- if either of the styles mentioned with
id1 or id2 are unknown to the factory.XFactory.mergeStyles(String, String, String)
void setPrintElementComments(boolean print)
createDocument()
-method
will print comments which were set with
XLElement.addElementComment(String)
.
The default is true.
XLElement.addElementComment(String)
boolean isPrintingElementComments()
createDocument()
-method
will include comments.
void setPrintDocComments(boolean print)
createDocument()
-method
will include docComments. DocComments are the comments that will
be passed in at the start of the Workbook document,
just after the processing instruction.
DocComments can be configured in the configuration file, standard at config/xelem.xml.
The default is true.
XFactory.getDocComments()
boolean isPrintingDocComments()
createDocument()
-method
will include docComments.
void appendInfoSheet()
void setDocumentProperties(DocumentProperties docProps)
docProps
- the DocumentProperties for this workbookDocumentProperties getDocumentProperties()
null
.boolean hasDocumentProperties()
void setExcelWorkbook(ExcelWorkbook excelWb)
excelWb
- The ExcelWorkbook for this workbookExcelWorkbook getExcelWorkbook()
null
.boolean hasExcelWorkbook()
NamedRange addNamedRange(String name, String refersTo)
The string refersTo
should be of format
[worksheet name]!R1C1:R1C1
.
If this workbook allready contained a NamedRange with the given name,
replaces it.
name
- The name to apply to the range.refersTo
- A String of R1C1 reference style, including worksheet name.
NamedRange addNamedRange(NamedRange namedRange)
namedRange
- the NamedRange to be added to this workbook
Map<String,NamedRange> getNamedRanges()
Worksheet addSheet()
Worksheet addSheet(String name)
name
- The name that is to be given to the new worksheet.
DuplicateNameException
- if a sheet with this name is allready
present in this workbook.Worksheet addSheet(Worksheet sheet)
sheet
- The worksheet to be added.
DuplicateNameException
- if a sheet with such a name is allready
present in this workbook.Worksheet removeSheet(String name)
name
- The name of the worksheet to remove.
null
if a worksheet with
the given name was not in this workbook.List<Worksheet> getWorksheets()
List<String> getSheetNames()
Collections.swap(workbook.getSheetNames(), 0, 2);will display the first worksheet added to this workbook at position 3.
No objects should be added to this list.
Worksheet getWorksheet(String name)
name
- The name of the worksheet.
null
if
no worksheet with that name was in this workbook.Worksheet getWorksheetAt(int index)
index
- the worksheet index number
null
if
no worksheet was at that indexDocument createDocument() throws ParserConfigurationException
Document
, the structure that holds this Workbook
and all of it's children.
During assembly
non fatal-errors will be registered as warnings. See getWarnings()
.
A new call to createDocument erases all previous warnings.
Non fatal-errors could be:
XFactory
could not be configured.
<Style ss:ID="foo"/>
).
appendInfoSheet()
was called, but an infoSheet-Node
could not be created.
Document
, representing this workbook.
ParserConfigurationException
- if the document could not be created.List<String> getWarnings()
createDocument()
.
|
xelem.3.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |