if(cri.isRow() && cri.getRepeated()==newRow-1) {
// We have the correct Row BIFFRecord for this row
RowStyle rStyle = new RowStyle("Default",SxcConstants.ROW_STYLE_FAMILY,
SxcConstants.DEFAULT_STYLE, cri.getSize(), null);
Style result[] = (Style[]) styleCat.getMatching(rStyle);
String styleName;
if(result.length==0) {
rStyle.setName("ro" + rowStyles++);
styleName = rStyle.getName();
Debug.log(Debug.TRACE,"No existing style found, adding " + styleName);
styleCat.add(rStyle);
} else {
RowStyle existingStyle = (RowStyle) result[0];
styleName = existingStyle.getName();
Debug.log(Debug.TRACE,"Existing style found : " + styleName);
}
rowElement.setAttribute(ATTRIBUTE_TABLE_STYLE_NAME, styleName);
// For now we will not use the repeat column attribute
}
}
// Append the row element to the root node
root.appendChild(rowElement);
// Update row number
row = newRow;
Debug.log(Debug.TRACE, "<tr>");
}
// Get the column number of the current cell
int newCol = decoder.getColNumber();
// Check to see if some columns were skipped
if (newCol != col) {
// How many columns have we skipped?
int numColsSkipped = newCol - col;
addEmptyCells(numColsSkipped, rowElement);
// Update the column number to account for the
// skipped cells
col = newCol;
}
// Lets start dealing with the cell data
Debug.log(Debug.TRACE, "<td>");
// Get the cell's contents
String cellContents = decoder.getCellContents();
// Get the type of the data in the cell
String cellType = decoder.getCellDataType();
// Get the cell format
Format fmt = decoder.getCellFormat();
// Create an element node for the cell
cellElement = (Element) doc.createElement(TAG_TABLE_CELL);
Node bodyNode = doc.getElementsByTagName(TAG_OFFICE_BODY).item(0);
// Not every document has an automatic style tag
autoStylesNode = doc.getElementsByTagName(
TAG_OFFICE_AUTOMATIC_STYLES).item(0);
if (autoStylesNode == null) {
autoStylesNode = doc.createElement(TAG_OFFICE_AUTOMATIC_STYLES);
doc.insertBefore(autoStylesNode, bodyNode);
}
CellStyle tStyle = new
CellStyle( "Default",SxcConstants.TABLE_CELL_STYLE_FAMILY,
SxcConstants.DEFAULT_STYLE, fmt, null);
String styleName;
Style result[] = (Style[]) styleCat.getMatching(tStyle);
if(result.length==0) {
tStyle.setName("ce" + textStyles++);
styleName = tStyle.getName();
Debug.log(Debug.TRACE,"No existing style found, adding " + styleName);