def _table_style_get(self, style_node): styles = [] for node in style_node.childNodes: if node.nodeType == node.ELEMENT_NODE: start = utils.tuple_int_get(node, 'start', (0, 0)) stop = utils.tuple_int_get(node, 'stop', (-1, -1)) if node.localName == 'blockValign': styles.append(('VALIGN', start, stop, str(node.getAttribute('value')))) elif node.localName == 'blockFont': styles.append( ('FONT', start, stop, str(node.getAttribute('name')))) elif node.localName == 'blockSpan': styles.append(('SPAN', start, stop)) elif node.localName == 'blockTextColor': styles.append( ('TEXTCOLOR', start, stop, color.get(str(node.getAttribute('colorName'))))) elif node.localName == 'blockLeading': styles.append( ('LEADING', start, stop, utils.unit_get(node.getAttribute('length')))) elif node.localName == 'blockAlignment': styles.append(('ALIGNMENT', start, stop, str(node.getAttribute('value')))) elif node.localName == 'blockLeftPadding': styles.append( ('LEFTPADDING', start, stop, utils.unit_get(node.getAttribute('length')))) elif node.localName == 'blockRightPadding': styles.append( ('RIGHTPADDING', start, stop, utils.unit_get(node.getAttribute('length')))) elif node.localName == 'blockTopPadding': styles.append( ('TOPPADDING', start, stop, utils.unit_get(node.getAttribute('length')))) elif node.localName == 'blockBottomPadding': styles.append( ('BOTTOMPADDING', start, stop, utils.unit_get(node.getAttribute('length')))) elif node.localName == 'blockBackground': styles.append(('BACKGROUND', start, stop, color.get(node.getAttribute('colorName')))) if node.hasAttribute('size'): styles.append(('FONTSIZE', start, stop, utils.unit_get(node.getAttribute('size')))) elif node.localName == 'lineStyle': kind = node.getAttribute('kind') kind_list = [ 'GRID', 'BOX', 'OUTLINE', 'INNERGRID', 'LINEBELOW', 'LINEABOVE', 'LINEBEFORE', 'LINEAFTER' ] assert kind in kind_list thick = 1 if node.hasAttribute('thickness'): thick = float(node.getAttribute('thickness')) styles.append((kind, start, stop, thick, color.get(node.getAttribute('colorName')))) return platypus.tables.TableStyle(styles)
def _table_style_get(self, style_node): styles = [] for node in style_node.childNodes: if node.nodeType == node.ELEMENT_NODE: start = utils.tuple_int_get(node, "start", (0, 0)) stop = utils.tuple_int_get(node, "stop", (-1, -1)) if node.localName == "blockValign": styles.append(("VALIGN", start, stop, str(node.getAttribute("value")))) elif node.localName == "blockFont": styles.append(("FONT", start, stop, str(node.getAttribute("name")))) elif node.localName == "blockTextColor": styles.append(("TEXTCOLOR", start, stop, color.get(str(node.getAttribute("colorName"))))) elif node.localName == "blockLeading": styles.append(("LEADING", start, stop, utils.unit_get(node.getAttribute("length")))) elif node.localName == "blockAlignment": styles.append(("ALIGNMENT", start, stop, str(node.getAttribute("value")))) elif node.localName == "blockLeftPadding": styles.append(("LEFTPADDING", start, stop, utils.unit_get(node.getAttribute("length")))) elif node.localName == "blockRightPadding": styles.append(("RIGHTPADDING", start, stop, utils.unit_get(node.getAttribute("length")))) elif node.localName == "blockTopPadding": styles.append(("TOPPADDING", start, stop, utils.unit_get(node.getAttribute("length")))) elif node.localName == "blockBottomPadding": styles.append(("BOTTOMPADDING", start, stop, utils.unit_get(node.getAttribute("length")))) elif node.localName == "blockBackground": styles.append(("BACKGROUND", start, stop, color.get(node.getAttribute("colorName")))) if node.hasAttribute("size"): styles.append(("FONTSIZE", start, stop, utils.unit_get(node.getAttribute("size")))) elif node.localName == "lineStyle": kind = node.getAttribute("kind") kind_list = [ "GRID", "BOX", "OUTLINE", "INNERGRID", "LINEBELOW", "LINEABOVE", "LINEBEFORE", "LINEAFTER", ] assert kind in kind_list thick = 1 if node.hasAttribute("thickness"): thick = float(node.getAttribute("thickness")) styles.append((kind, start, stop, thick, color.get(node.getAttribute("colorName")))) return platypus.tables.TableStyle(styles)
def _table_style_get(self, style_node): styles = [] for node in style_node.childNodes: if node.nodeType==node.ELEMENT_NODE: start = utils.tuple_int_get(node, 'start', (0,0) ) stop = utils.tuple_int_get(node, 'stop', (-1,-1) ) if node.localName=='blockValign': styles.append(('VALIGN', start, stop, str(node.getAttribute('value')))) elif node.localName=='blockFont': styles.append(('FONT', start, stop, str(node.getAttribute('name')))) elif node.localName=='blockSpan': styles.append(('SPAN', start, stop)) elif node.localName=='blockTextColor': styles.append(('TEXTCOLOR', start, stop, color.get(str(node.getAttribute('colorName'))))) elif node.localName=='blockLeading': styles.append(('LEADING', start, stop, utils.unit_get(node.getAttribute('length')))) elif node.localName=='blockAlignment': styles.append(('ALIGNMENT', start, stop, str(node.getAttribute('value')))) elif node.localName=='blockLeftPadding': styles.append(('LEFTPADDING', start, stop, utils.unit_get(node.getAttribute('length')))) elif node.localName=='blockRightPadding': styles.append(('RIGHTPADDING', start, stop, utils.unit_get(node.getAttribute('length')))) elif node.localName=='blockTopPadding': styles.append(('TOPPADDING', start, stop, utils.unit_get(node.getAttribute('length')))) elif node.localName=='blockBottomPadding': styles.append(('BOTTOMPADDING', start, stop, utils.unit_get(node.getAttribute('length')))) elif node.localName=='blockBackground': styles.append(('BACKGROUND', start, stop, color.get(node.getAttribute('colorName')))) if node.hasAttribute('size'): styles.append(('FONTSIZE', start, stop, utils.unit_get(node.getAttribute('size')))) elif node.localName=='lineStyle': kind = node.getAttribute('kind') kind_list = [ 'GRID', 'BOX', 'OUTLINE', 'INNERGRID', 'LINEBELOW', 'LINEABOVE','LINEBEFORE', 'LINEAFTER' ] assert kind in kind_list thick = 1 if node.hasAttribute('thickness'): thick = float(node.getAttribute('thickness')) styles.append((kind, start, stop, thick, color.get(node.getAttribute('colorName')))) return platypus.tables.TableStyle(styles)