def write_conditional_formatting(worksheet):
 wb = worksheet.parent
 for (range_string, rules) in iteritems(worksheet.conditional_formatting.cf_rules):
  cf = Element('conditionalFormatting', {'sqref': range_string})
  for rule in rules:
   if (rule.dxf is not None):
    if (rule.dxf != DifferentialStyle()):
     rule.dxfId = len(wb._differential_styles)
     wb._differential_styles.append(rule.dxf)
   cf.append(rule.to_tree())
  (yield cf)

def write_conditional_formatting ( worksheet ) : wb = worksheet . parent for ( range_string , rules ) in iteritems ( worksheet . conditional_formatting . cf_rules ) : cf = Element ( 'conditionalFormatting' , { 'sqref' : range_string } ) for rule in rules : if ( rule . dxf is not None ) : if ( rule . dxf != DifferentialStyle ( ) ) : rule . dxfId = len ( wb . _differential_styles ) wb . _differential_styles . append ( rule . dxf ) cf . append ( rule . to_tree ( ) ) ( yield cf )
write conditional formatting to xml .