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

        if not hasattr(root, "findall"):
            root = Element("xml")
        # Remove any existing comment shapes
        comments = root.findall("{%s}shape[@type='#_x0000_t202']" % vmlns)
        for c in comments:
            root.remove(c)

        # check whether comments shape type already exists

        shape_types = root.find("{%s}shapetype[@id='_x0000_t202']" % vmlns)
        if not shape_types:
            self.add_comment_shapetype(root)

        for idx, (coord, comment) in enumerate(self.comments, 1026):
            self.add_comment_shape(root, idx, coord)

        return tostring(root)
Exemplo n.º 2
0
    def write(self, root):

        if not hasattr(root, "findall"):
            root = Element("xml")

        # Remove any existing comment shapes
        comments = root.findall("{%s}shape[@type='#_x0000_t202']" % vmlns)
        for c in comments:
            root.remove(c)

        # check whether comments shape type already exists
        shape_types = root.find("{%s}shapetype[@id='_x0000_t202']" % vmlns)
        if not shape_types:
            self.add_comment_shapetype(root)

        for idx, (coord, comment) in enumerate(self.comments, 1026):
            self.add_comment_shape(root, idx, coord, comment.height, comment.width)

        return tostring(root)
Exemplo n.º 3
0
 def test_write_color(self, value, expected):
     w = StyleWriter(self.workbook)
     root = Element("root")
     w._write_color(root, value)
     assert root.find('color') is not None
     assert root.find('color').attrib == expected
 def test_write_color(self, value, expected):
     w = StyleWriter(self.workbook)
     root = Element("root")
     w._write_color(root, value)
     assert root.find('color') is not None
     assert root.find('color').attrib == expected