How to use the openpyxl.xml.functions.end_tag function in openpyxl

To help you get started, we’ve selected a few openpyxl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ericgazoni / openpyxl / openpyxl / writer / worksheet.py View on Github external
'tint': str(color.index).split(':')[2]})
                        else:
                            tag(doc, 'color', {'theme': str(color.index).split(':')[1]})
                    else:
                        tag(doc, 'color', {'rgb': str(color.index)})
                end_tag(doc, 'colorScale')
            if 'iconSet' in rule:
                iconAttr = {}
                for icon_attr in ConditionalFormatting.icon_attributes:
                    if icon_attr in rule['iconSet']:
                        iconAttr[icon_attr] = rule['iconSet'][icon_attr]
                start_tag(doc, 'iconSet', iconAttr)
                for cfvo in rule['iconSet']['cfvo']:
                    tag(doc, 'cfvo', cfvo)
                end_tag(doc, 'iconSet')
            end_tag(doc, 'cfRule')
        end_tag(doc, 'conditionalFormatting')
github ericgazoni / openpyxl / openpyxl / writer / worksheet.py View on Github external
tag(doc, 'color', {'theme': str(color.index).split(':')[1],
                                               'tint': str(color.index).split(':')[2]})
                        else:
                            tag(doc, 'color', {'theme': str(color.index).split(':')[1]})
                    else:
                        tag(doc, 'color', {'rgb': str(color.index)})
                end_tag(doc, 'colorScale')
            if 'iconSet' in rule:
                iconAttr = {}
                for icon_attr in ConditionalFormatting.icon_attributes:
                    if icon_attr in rule['iconSet']:
                        iconAttr[icon_attr] = rule['iconSet'][icon_attr]
                start_tag(doc, 'iconSet', iconAttr)
                for cfvo in rule['iconSet']['cfvo']:
                    tag(doc, 'cfvo', cfvo)
                end_tag(doc, 'iconSet')
            end_tag(doc, 'cfRule')
        end_tag(doc, 'conditionalFormatting')
github ericgazoni / openpyxl / openpyxl / writer / worksheet.py View on Github external
else:
                            tag(doc, 'color', {'theme': str(color.index).split(':')[1]})
                    else:
                        tag(doc, 'color', {'rgb': str(color.index)})
                end_tag(doc, 'colorScale')
            if 'iconSet' in rule:
                iconAttr = {}
                for icon_attr in ConditionalFormatting.icon_attributes:
                    if icon_attr in rule['iconSet']:
                        iconAttr[icon_attr] = rule['iconSet'][icon_attr]
                start_tag(doc, 'iconSet', iconAttr)
                for cfvo in rule['iconSet']['cfvo']:
                    tag(doc, 'cfvo', cfvo)
                end_tag(doc, 'iconSet')
            end_tag(doc, 'cfRule')
        end_tag(doc, 'conditionalFormatting')
github ericgazoni / openpyxl / openpyxl / writer / worksheet.py View on Github external
tag(doc, 'color', {'theme': str(color.index).split(':')[1],
                                               'tint': str(color.index).split(':')[2]})
                        else:
                            tag(doc, 'color', {'theme': str(color.index).split(':')[1]})
                    else:
                        tag(doc, 'color', {'rgb': str(color.index)})
                end_tag(doc, 'colorScale')
            if 'iconSet' in rule:
                iconAttr = {}
                for icon_attr in ConditionalFormatting.icon_attributes:
                    if icon_attr in rule['iconSet']:
                        iconAttr[icon_attr] = rule['iconSet'][icon_attr]
                start_tag(doc, 'iconSet', iconAttr)
                for cfvo in rule['iconSet']['cfvo']:
                    tag(doc, 'cfvo', cfvo)
                end_tag(doc, 'iconSet')
            end_tag(doc, 'cfRule')
        end_tag(doc, 'conditionalFormatting')
github ericgazoni / openpyxl / openpyxl / writer / worksheet.py View on Github external
tag(doc, 'f', attr=attr, body='%s' % value[1:])
                    else:
                        tag(doc, 'f', body='%s' % value[1:])
                    tag(doc, 'v')
                elif cell.data_type == cell.TYPE_NUMERIC:
                    if isinstance(value, (long, decimal.Decimal)):
                        func = str
                    else:
                        func = repr
                    tag(doc, 'v', body=func(value))
                elif cell.data_type == cell.TYPE_BOOL:
                    tag(doc, 'v', body='%d' % value)
                else:
                    tag(doc, 'v', body='%s' % value)
                end_tag(doc, 'c')
        end_tag(doc, 'row')
    end_tag(doc, 'sheetData')
github ericgazoni / openpyxl / openpyxl / writer / worksheet.py View on Github external
else:
                        tag(doc, 'f', body='%s' % value[1:])
                    tag(doc, 'v')
                elif cell.data_type == cell.TYPE_NUMERIC:
                    if isinstance(value, (long, decimal.Decimal)):
                        func = str
                    else:
                        func = repr
                    tag(doc, 'v', body=func(value))
                elif cell.data_type == cell.TYPE_BOOL:
                    tag(doc, 'v', body='%d' % value)
                else:
                    tag(doc, 'v', body='%s' % value)
                end_tag(doc, 'c')
        end_tag(doc, 'row')
    end_tag(doc, 'sheetData')
github ericgazoni / openpyxl / openpyxl / writer / worksheet.py View on Github external
if column > 1:
                pane = 'bottomRight'
        paneAttrs.update(dict(topLeftCell=topLeftCell,
                              activePane=pane,
                              state='frozen'))
        tag(doc, 'pane', paneAttrs)
        selectionAttrs['pane'] = pane
        if row > 1 and column > 1:
            tag(doc, 'selection', {'pane': 'topRight'})
            tag(doc, 'selection', {'pane': 'bottomLeft'})

    selectionAttrs.update({'activeCell': worksheet.active_cell,
                           'sqref': worksheet.selected_cell})

    tag(doc, 'selection', selectionAttrs)
    end_tag(doc, 'sheetView')
    end_tag(doc, 'sheetViews')
github ericgazoni / openpyxl / openpyxl / writer / worksheet.py View on Github external
def write_worksheet_autofilter(doc, worksheet):
    auto_filter = worksheet.auto_filter
    if auto_filter.filter_columns or auto_filter.sort_conditions:
        start_tag(doc, 'autoFilter', {'ref': auto_filter.ref})
        for col_id, filter_column in sorted(auto_filter.filter_columns.items()):
            start_tag(doc, 'filterColumn', {'colId': str(col_id)})
            if filter_column.blank:
                start_tag(doc, 'filters', {'blank': '1'})
            else:
                start_tag(doc, 'filters')
            for val in filter_column.vals:
                tag(doc, 'filter', {'val': val})
            end_tag(doc, 'filters')
            end_tag(doc, 'filterColumn')
        if auto_filter.sort_conditions:
            start_tag(doc, 'sortState', {'ref': auto_filter.ref})
            for sort_condition in auto_filter.sort_conditions:
                sort_attr = {'ref': sort_condition.ref}
                if sort_condition.descending:
                    sort_attr['descending'] = '1'
                tag(doc, 'sortCondtion', sort_attr)
            end_tag(doc, 'sortState')
        end_tag(doc, 'autoFilter')
    elif auto_filter.ref:
        tag(doc, 'autoFilter', {'ref': auto_filter.ref})
github ericgazoni / openpyxl / openpyxl / writer / worksheet.py View on Github external
if filter_column.blank:
                start_tag(doc, 'filters', {'blank': '1'})
            else:
                start_tag(doc, 'filters')
            for val in filter_column.vals:
                tag(doc, 'filter', {'val': val})
            end_tag(doc, 'filters')
            end_tag(doc, 'filterColumn')
        if auto_filter.sort_conditions:
            start_tag(doc, 'sortState', {'ref': auto_filter.ref})
            for sort_condition in auto_filter.sort_conditions:
                sort_attr = {'ref': sort_condition.ref}
                if sort_condition.descending:
                    sort_attr['descending'] = '1'
                tag(doc, 'sortCondtion', sort_attr)
            end_tag(doc, 'sortState')
        end_tag(doc, 'autoFilter')
    elif auto_filter.ref:
        tag(doc, 'autoFilter', {'ref': auto_filter.ref})
github ericgazoni / openpyxl / openpyxl / writer / worksheet.py View on Github external
def write_worksheet_autofilter(doc, worksheet):
    auto_filter = worksheet.auto_filter
    if auto_filter.filter_columns or auto_filter.sort_conditions:
        start_tag(doc, 'autoFilter', {'ref': auto_filter.ref})
        for col_id, filter_column in sorted(auto_filter.filter_columns.items()):
            start_tag(doc, 'filterColumn', {'colId': str(col_id)})
            if filter_column.blank:
                start_tag(doc, 'filters', {'blank': '1'})
            else:
                start_tag(doc, 'filters')
            for val in filter_column.vals:
                tag(doc, 'filter', {'val': val})
            end_tag(doc, 'filters')
            end_tag(doc, 'filterColumn')
        if auto_filter.sort_conditions:
            start_tag(doc, 'sortState', {'ref': auto_filter.ref})
            for sort_condition in auto_filter.sort_conditions:
                sort_attr = {'ref': sort_condition.ref}
                if sort_condition.descending:
                    sort_attr['descending'] = '1'
                tag(doc, 'sortCondtion', sort_attr)
            end_tag(doc, 'sortState')
        end_tag(doc, 'autoFilter')
    elif auto_filter.ref:
        tag(doc, 'autoFilter', {'ref': auto_filter.ref})