def write_rows(xf, worksheet):
 all_rows = get_rows_to_write(worksheet)
 dims = worksheet.row_dimensions
 max_column = worksheet.max_column
 with xf.element('sheetData'):
  for (row_idx, row) in all_rows:
   attrs = {'r': ('%d' % row_idx), 'spans': ('1:%d' % max_column)}
   if (row_idx in dims):
    row_dimension = dims[row_idx]
    attrs.update(dict(row_dimension))
   with xf.element('row', attrs):
    for (col, cell) in sorted(row, key=itemgetter(0)):
     if ((cell.value is None) and (not cell.has_style)):
      continue
     el = write_cell(worksheet, cell, cell.has_style)
     xf.write(el)

def write_rows ( xf , worksheet ) : all_rows = get_rows_to_write ( worksheet ) dims = worksheet . row_dimensions max_column = worksheet . max_column with xf . element ( 'sheetData' ) : for ( row_idx , row ) in all_rows : attrs = { 'r' : ( '%d' % row_idx ) , 'spans' : ( '1:%d' % max_column ) } if ( row_idx in dims ) : row_dimension = dims [ row_idx ] attrs . update ( dict ( row_dimension ) ) with xf . element ( 'row' , attrs ) : for ( col , cell ) in sorted ( row , key = itemgetter ( 0 ) ) : if ( ( cell . value is None ) and ( not cell . has_style ) ) : continue el = write_cell ( worksheet , cell , cell . has_style ) xf . write ( el )
write worksheet data to xml .