Exemplo n.º 1
0
    def _write_print_settings(self, root):

        settings = SubElement(root, '{%s}printSettings' % CHART_NS)
        SubElement(settings, '{%s}headerFooter' % CHART_NS)
        margins = dict([(k, safe_string(v)) for (k, v) in iteritems(self.chart.print_margins)])
        SubElement(settings, '{%s}pageMargins' % CHART_NS, margins)
        SubElement(settings, '{%s}pageSetup' % CHART_NS)
Exemplo n.º 2
0
    def _write_print_settings(self):

        settings = SubElement(self.root, '{%s}printSettings' % CHART_NS)
        SubElement(settings, '{%s}headerFooter' % CHART_NS)
        margins = dict([(k, safe_string(v)) for (k, v) in iteritems(self.chart.print_margins)])
        SubElement(settings, '{%s}pageMargins' % CHART_NS, margins)
        SubElement(settings, '{%s}pageSetup' % CHART_NS)
Exemplo n.º 3
0
 def setRules(self, cfRules):
     """Set the conditional formatting rules from a dictionary.  Intended for use when loading a document.
     cfRules use the structure: {range_string: [rule1, rule2]}, eg:
     {'A1:A4': [{'type': 'colorScale', 'priority': '13', 'colorScale': {'cfvo': [{'type': 'min'}, {'type': 'max'}],
     'color': [Color('FFFF7128'), Color('FFFFEF9C')]}]}
     """
     self.cf_rules = {}
     self.max_priority = 0
     priorityMap = []
     for range_string, rules in iteritems(cfRules):
         self.cf_rules[range_string] = rules
         for rule in rules:
             priorityMap.append(int(rule['priority']))
     priorityMap.sort()
     for range_string, rules in iteritems(cfRules):
         self.cf_rules[range_string] = rules
         for rule in rules:
             priority = priorityMap.index(int(rule['priority'])) + 1
             rule['priority'] = str(priority)
             if 'priority' in rule and priority > self.max_priority:
                 self.max_priority = priority
Exemplo n.º 4
0
 def setRules(self, cfRules):
     """Set the conditional formatting rules from a dictionary.  Intended for use when loading a document.
     cfRules use the structure: {range_string: [rule1, rule2]}, eg:
     {'A1:A4': [{'type': 'colorScale', 'priority': '13', 'colorScale': {'cfvo': [{'type': 'min'}, {'type': 'max'}],
     'color': [Color('FFFF7128'), Color('FFFFEF9C')]}]}
     """
     self.cf_rules = {}
     self.max_priority = 0
     priorityMap = []
     for range_string, rules in iteritems(cfRules):
         self.cf_rules[range_string] = rules
         for rule in rules:
             priorityMap.append(int(rule['priority']))
     priorityMap.sort()
     for range_string, rules in iteritems(cfRules):
         self.cf_rules[range_string] = rules
         for rule in rules:
             priority = priorityMap.index(int(rule['priority'])) + 1
             rule['priority'] = str(priority)
             if 'priority' in rule and priority > self.max_priority:
                 self.max_priority = priority
Exemplo n.º 5
0
    def _write_print_settings(self, root):

        settings = SubElement(root, '{%s}printSettings' % CHART_NS)
        SubElement(settings, '{%s}headerFooter' % CHART_NS)
        try:
            # Python 2
            print_margins_items = iteritems(self.chart.print_margins)
        except AttributeError:
            # Python 3
            print_margins_items = self.chart.print_margins.items()

        margins = dict([(k, safe_string(v)) for (k, v) in print_margins_items])
        SubElement(settings, '{%s}pageMargins' % CHART_NS, margins)
        SubElement(settings, '{%s}pageSetup' % CHART_NS)
Exemplo n.º 6
0
    def __init__(self, sheet):
        self.sheet = sheet

        # get list of comments
        self.comments = []
        for coord, cell in iteritems(sheet._cells):
            if cell.comment is not None:
                self.comments.append(cell.comment)

        # get list of authors
        self.authors = []
        self.author_to_id = {}
        for comment in self.comments:
            if comment.author not in self.author_to_id:
                self.author_to_id[comment.author] = str(len(self.authors))
                self.authors.append(comment.author)
Exemplo n.º 7
0
    def __init__(self, sheet):
        self.sheet = sheet

        # get list of comments
        self.comments = []
        for coord, cell in iteritems(sheet._cells):
            if cell.comment is not None:
                self.comments.append(cell.comment)

        # get list of authors
        self.authors = []
        self.author_to_id = {}
        for comment in self.comments:
            if comment.author not in self.author_to_id:
                self.author_to_id[comment.author] = str(len(self.authors))
                self.authors.append(comment.author)
Exemplo n.º 8
0
 def update(self, dictionary):
     for k, v in iteritems(dictionary):
         self[k] = v
Exemplo n.º 9
0
 def update(self, dictionary):
     for k, v in iteritems(dictionary):
         self[k] = v