Example #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)
Example #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)
Example #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
Example #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
Example #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)
Example #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)
    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)
Example #8
0
 def update(self, dictionary):
     for k, v in iteritems(dictionary):
         self[k] = v
Example #9
0
 def update(self, dictionary):
     for k, v in iteritems(dictionary):
         self[k] = v