|
xelem.3.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.fountain.xelem.excel.AbstractXLElement
nl.fountain.xelem.excel.ss.XLWorkbook
public class XLWorkbook
An implementation of the XLElement Workbook, the root of a SpreadsheetML document.
Typically, the XLWorkbook is at the start of creating an Excel workbook in SpreadsheetML. Mostly all of the other objects in xelem can be obtained from it or through it by one of the addXxx- methods.
After setting up the workbook, you can obtain the
org.w3c.dom.Document from it (see
createDocument()) or serialize the workbook by means of one of the
serialize-methods of the
XSerializer.class,
which was included in xelem for convenience.
Worksheets are displayed in Excel in the order that they were added to the
workbook. The methods removeSheet(String) and
addSheet(Worksheet) may savely be applied to change this order.
A more convenient way is to obtain the
list of sheet names with getSheetNames() and manupulating this list.
| 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 |
| Constructor Summary | |
|---|---|
XLWorkbook()
Creates a new XLWorkbook. |
|
XLWorkbook(String name)
Creates a new XLWorkbook with the given name. |
|
| Method Summary | |
|---|---|
NamedRange |
addNamedRange(NamedRange nr)
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. |
Element |
assemble(Element root,
GIO gio)
Assembles the state of this XLElement and all of it's children into an Element. |
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. |
String |
getNameSpace()
Gets the namespace of this XLElement. |
String |
getPrefix()
Gets the prefix of this XLElement. |
List<String> |
getSheetNames()
Gets a list of all the names of worksheets in this workbook in display order. |
String |
getTagName()
Gets the tagname (localName) of this XLElement. |
List<String> |
getWarnings()
Gets a list of warnings (Strings) that were registered during assembly of this workbook after a call to Workbook.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 Workbook.createDocument()-method
will include docComments. |
boolean |
isPrintingElementComments()
Specifies whether this Workbook's Workbook.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 Workbook.createDocument()-method
will include docComments. |
void |
setPrintElementComments(boolean print)
Sets whether this Workbook's Workbook.createDocument()-method
will print comments which were set with
XLElement.addElementComment(String). |
| Methods inherited from class nl.fountain.xelem.excel.AbstractXLElement |
|---|
addElementComment, assemble, createAttributeNS, createAttributeNS, createElementNS, createElementNS, createElementNS, createElementNS, getElementComments, setAttributes, setChildElement |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface nl.fountain.xelem.excel.XLElement |
|---|
addElementComment, getElementComments, setAttributes, setChildElement |
| Constructor Detail |
|---|
public XLWorkbook()
public XLWorkbook(String name)
| Method Detail |
|---|
public void setName(String name)
Workbook
setName in interface Workbookpublic String getName()
Workbook
getName in interface Workbookpublic void setFileName(String filename)
Workbook
setFileName in interface Workbookpublic String getFileName()
WorkbookWorkbook.setFileName(String) the name of the workbook is returned
with the extension '.xls'.
getFileName in interface Workbook
public void mergeStyles(String newID,
String id1,
String id2)
throws UnsupportedStyleException
Workbook
mergeStyles in interface WorkbooknewID - 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)public void appendInfoSheet()
Workbook
appendInfoSheet in interface Workbookpublic void setDocumentProperties(DocumentProperties docProps)
Workbook
setDocumentProperties in interface WorkbookdocProps - the DocumentProperties for this workbookpublic DocumentProperties getDocumentProperties()
Workbook
getDocumentProperties in interface Workbooknull.public boolean hasDocumentProperties()
Workbook
hasDocumentProperties in interface Workbookpublic void setExcelWorkbook(ExcelWorkbook excelWb)
Workbook
setExcelWorkbook in interface WorkbookexcelWb - The ExcelWorkbook for this workbookpublic ExcelWorkbook getExcelWorkbook()
Workbook
getExcelWorkbook in interface Workbooknull.public boolean hasExcelWorkbook()
Workbook
hasExcelWorkbook in interface Workbookpublic NamedRange addNamedRange(NamedRange nr)
Workbook
addNamedRange in interface Workbooknr - the NamedRange to be added to this workbook
public NamedRange addNamedRange(String name,
String refersTo)
Workbook
The string refersTo should be of format
[worksheet name]!R1C1:R1C1.
If this workbook allready contained a NamedRange with the given name,
replaces it.
addNamedRange in interface Workbookname - The name to apply to the range.refersTo - A String of R1C1 reference style, including worksheet name.
public Map<String,NamedRange> getNamedRanges()
Workbook
getNamedRanges in interface Workbookpublic Worksheet addSheet()
Workbook
addSheet in interface Workbookpublic Worksheet addSheet(String name)
Workbook
addSheet in interface Workbookname - The name that is to be given to the new worksheet.
public Worksheet addSheet(Worksheet sheet)
Workbook
addSheet in interface Workbooksheet - The worksheet to be added.
public List<Worksheet> getWorksheets()
Workbook
getWorksheets in interface Workbookpublic List<String> getSheetNames()
WorkbookCollections.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.
getSheetNames in interface Workbookpublic Worksheet getWorksheet(String name)
Workbook
getWorksheet in interface Workbookname - The name of the worksheet.
null if
no worksheet with that name was in this workbook.public Worksheet getWorksheetAt(int index)
Workbook
getWorksheetAt in interface Workbookindex - the worksheet index number
null if
no worksheet was at that indexpublic Worksheet removeSheet(String name)
Workbook
removeSheet in interface Workbookname - The name of the worksheet to remove.
null if a worksheet with
the given name was not in this workbook.public void setPrintElementComments(boolean print)
WorkbookWorkbook.createDocument()-method
will print comments which were set with
XLElement.addElementComment(String).
The default is true.
setPrintElementComments in interface WorkbookXLElement.addElementComment(String)public void setPrintDocComments(boolean print)
WorkbookWorkbook.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.
setPrintDocComments in interface WorkbookXFactory.getDocComments()public boolean isPrintingElementComments()
WorkbookWorkbook.createDocument()-method
will include comments.
isPrintingElementComments in interface Workbookpublic boolean isPrintingDocComments()
WorkbookWorkbook.createDocument()-method
will include docComments.
isPrintingDocComments in interface Workbookpublic String getTagName()
XLElement
getTagName in interface XLElementpublic String getNameSpace()
XLElement
getNameSpace in interface XLElementpublic String getPrefix()
XLElement
getPrefix in interface XLElement
public Document createDocument()
throws ParserConfigurationException
WorkbookDocument, the structure that holds this Workbook
and all of it's children.
During assembly
non fatal-errors will be registered as warnings. See Workbook.getWarnings().
A new call to createDocument erases all previous warnings.
Non fatal-errors could be:
XFactory could not be configured.
<Style ss:ID="foo"/>).
Workbook.appendInfoSheet() was called, but an infoSheet-Node
could not be created.
createDocument in interface WorkbookDocument, representing this workbook.
ParserConfigurationException - if the document could not be created.
public Element assemble(Element root,
GIO gio)
XLElementElement. Attaches the new element to it's
parent-element if needed.
assemble in interface XLElementroot - the parent-element to which the new formed element
will be appendedgio - a global information object
public List<String> getWarnings()
WorkbookWorkbook.createDocument().
getWarnings in interface Workbook
|
xelem.3.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||