def dset_sheet(dataset, ws):
 _package = dataset._package(dicts=False)
 for (i, sep) in enumerate(dataset._separators):
  _offset = i
  _package.insert((sep[0] + _offset), (sep[1],))
 for (i, row) in enumerate(_package):
  row_number = (i + 1)
  odf_row = table.TableRow(stylename=bold, defaultcellstylename='bold')
  for (j, col) in enumerate(row):
   try:
    col = unicode(col, errors='ignore')
   except TypeError:
    pass
   ws.addElement(table.TableColumn())
   if ((row_number == 1) and dataset.headers):
    odf_row.setAttribute('stylename', bold)
    ws.addElement(odf_row)
    cell = table.TableCell()
    p = text.P()
    p.addElement(text.Span(text=col, stylename=bold))
    cell.addElement(p)
    odf_row.addElement(cell)
   else:
    try:
     if ('\n' in col):
      ws.addElement(odf_row)
      cell = table.TableCell()
      cell.addElement(text.P(text=col))
      odf_row.addElement(cell)
     else:
      ws.addElement(odf_row)
      cell = table.TableCell()
      cell.addElement(text.P(text=col))
      odf_row.addElement(cell)
    except TypeError:
     ws.addElement(odf_row)
     cell = table.TableCell()
     cell.addElement(text.P(text=col))
     odf_row.addElement(cell)

def dset_sheet ( dataset , ws ) : _package = dataset . _package ( dicts = False ) for ( i , sep ) in enumerate ( dataset . _separators ) : _offset = i _package . insert ( ( sep [ 0 ] + _offset ) , ( sep [ 1 ] , ) ) for ( i , row ) in enumerate ( _package ) : row_number = ( i + 1 ) odf_row = table . TableRow ( stylename = bold , defaultcellstylename = 'bold' ) for ( j , col ) in enumerate ( row ) : try : col = unicode ( col , errors = 'ignore' ) except TypeError : pass ws . addElement ( table . TableColumn ( ) ) if ( ( row_number == 1 ) and dataset . headers ) : odf_row . setAttribute ( 'stylename' , bold ) ws . addElement ( odf_row ) cell = table . TableCell ( ) p = text . P ( ) p . addElement ( text . Span ( text = col , stylename = bold ) ) cell . addElement ( p ) odf_row . addElement ( cell ) else : try : if ( '\n' in col ) : ws . addElement ( odf_row ) cell = table . TableCell ( ) cell . addElement ( text . P ( text = col ) ) odf_row . addElement ( cell ) else : ws . addElement ( odf_row ) cell = table . TableCell ( ) cell . addElement ( text . P ( text = col ) ) odf_row . addElement ( cell ) except TypeError : ws . addElement ( odf_row ) cell = table . TableCell ( ) cell . addElement ( text . P ( text = col ) ) odf_row . addElement ( cell )
completes given worksheet from given dataset .