Object[] valueCellRange = getValueCellRange();
for (int i = 0; i < numColumns; i++) {
TableTableCellElement cell = headerRow.newTableTableCellElement(0.0, "string");
cell.setOfficeValueTypeAttribute(OfficeValueTypeAttribute.Value.STRING.toString());
String[] cellContents = dataset.getLocalTableFirstRow();
OdfTextParagraph paragraph = (OdfTextParagraph) cell.newTextPElement();
if (isFirstRowAsLabel && !isRowAsSeries) {
if ((String) labelCellRange[i] != null) {
paragraph.setTextIdAttribute((String) labelCellRange[i]);
}
}
if (isFirstRowAsLabel && isRowAsSeries && i == 0) {
if ((String) getTableCellRange() != null) {
paragraph.setTextIdAttribute(getTableCellRange());
}
}
if (cellContents[i] != null) {
paragraph.setTextContent(cellContents[i]);
} else {
paragraph.setTextContent("");
}
}
// create table rows
Double[][] cellValues = dataset.getLocalTableData();
for (int i = 0; i < numRows; i++) {
TableTableRowElement row = rows.newTableTableRowElement();
TableTableCellElement nameCell = row.newTableTableCellElement(0.0, "string");
nameCell.setOfficeValueTypeAttribute(OfficeValueTypeAttribute.Value.STRING.toString());
OdfTextParagraph paragraph = (OdfTextParagraph) nameCell.newTextPElement();
String[] cellContents = dataset.getLocalTableFirstColumn();
if (cellContents[i] != null) {
if (isFirstColumnAsLabel) {
if (isRowAsSeries) {
paragraph.setTextIdAttribute((String) labelCellRange[i]);
}
if (!isRowAsSeries && i == 0) {
paragraph.setTextIdAttribute(getTableCellRange());
}
}
paragraph.setTextContent(cellContents[i]);
} else {
paragraph.setTextContent("");
}
for (int j = 0; j < numColumns; j++) {
TableTableCellElement cell = row.newTableTableCellElement(0.0, "string");
cell.setOfficeValueTypeAttribute(OfficeValueTypeAttribute.Value.FLOAT.toString());
if (cellValues[i][j] != null) {
cell.setOfficeValueAttribute(cellValues[i][j]);
OdfTextParagraph paragraph1 = (OdfTextParagraph) cell.newTextPElement();
paragraph1.setTextContent(cellValues[i][j].toString());
if (isRowAsSeries && j == 0) {
paragraph1.setTextIdAttribute((String) valueCellRange[i]);
}
if (!isRowAsSeries && i == 0) {
paragraph1.setTextIdAttribute((String) valueCellRange[j]);
}
} else {
cell.setOfficeValueAttribute(new Double(Double.NaN));
OdfTextParagraph paragraph1 = (OdfTextParagraph) cell.newTextPElement();
paragraph1.setTextContent("1.#NAN");
if (isRowAsSeries && j == 0) {
paragraph1.setTextIdAttribute((String) valueCellRange[i]);
}
if (!isRowAsSeries && i == 0) {
paragraph1.setTextIdAttribute((String) valueCellRange[j]);
}
}
}
}
}