if (this.template != null)
writeRowStyle( row.getStyleName() );
final List<? extends CellInstance> cells = row.getCellList();
for (int ci = 0; ci != cells.size(); ci++) {
final CellInstance cell = cells.get( ci );
writeStartElement( XMLConstants.Main.CELL );
final StringBuilder sb = new StringBuilder();
CellAddressImpl.appendNameA1ForCellIndex( sb, ci, false, ri, false );
writeAttribute( XMLConstants.Main.CELL_REFERENCE, sb.toString() );
final Object value = cell == null ? null : cell.getValue();
final ExpressionNode expression;
if (cell != null && cell instanceof CellWithExpression)
expression = ((CellWithExpression) cell).getExpression();
else
expression = null;
if (cell != null)
writeCellStyle( value, cell.getStyleName() );
if (expression != null) {
writeStartElement( XMLConstants.Main.CELL_FORMULA );
writeText( ExpressionFormatter.format( expression, cell.getCellIndex() ) );
writeEndElement( XMLConstants.Main.CELL_FORMULA );
}
if (value != null) {
writeStartElement( XMLConstants.Main.CELL_VALUE );