def _write_header(self):
        """
        Generator that creates the XML file and the sheet header
        """

        with xmlfile(self.filename) as xf:
            with xf.element("worksheet", xmlns=SHEET_MAIN_NS):

                if self.sheet_properties:
                    pr = write_sheetPr(self.sheet_properties)

                xf.write(pr)
                views = Element("sheetViews")
                views.append(self.sheet_view.to_tree())
                xf.write(views)
                xf.write(write_format(self))

                cols = write_cols(self)
                if cols is not None:
                    xf.write(cols)

                with xf.element("sheetData"):
                    try:
                        while True:
                            r = (yield)
                            xf.write(r)
                    except GeneratorExit:
                        pass
                af = write_autofilter(self)
                if af is not None:
                    xf.write(af)
                if self._comments:
                    comments = Element("legacyDrawing", {"{%s}id" % REL_NS: "commentsvml"})
                    xf.write(comments)
    def _write_header(self):
        """
        Generator that creates the XML file and the sheet header
        """

        with xmlfile(self.filename) as xf:
            with xf.element("worksheet", xmlns=SHEET_MAIN_NS):

                if self.sheet_properties:
                    pr = write_sheetPr(self.sheet_properties)

                xf.write(pr)
                views = Element('sheetViews')
                views.append(self.sheet_view.to_tree())
                xf.write(views)
                xf.write(write_format(self))

                cols = write_cols(self)
                if cols is not None:
                    xf.write(cols)

                with xf.element("sheetData"):
                    try:
                        while True:
                            r = (yield)
                            xf.write(r)
                    except GeneratorExit:
                        pass
                if self.protection.sheet:
                    prot = Element('sheetProtection', dict(self.protection))
                    xf.write(prot)
                af = write_autofilter(self)
                if af is not None:
                    xf.write(af)
                dv = write_datavalidation(self)
                if dv is not None:
                    xf.write(dv)
                if self._comments:
                    comments = Element('legacyDrawing',
                                       {'{%s}id' % REL_NS: 'commentsvml'})
                    xf.write(comments)
Example #3
0
    def _write_header(self):
        """
        Generator that creates the XML file and the sheet header
        """

        with xmlfile(self.filename) as xf:
            with xf.element("worksheet", xmlns=SHEET_MAIN_NS):

                if self.sheet_properties:
                    pr = write_sheetPr(self.sheet_properties)

                xf.write(pr)
                views = Element('sheetViews')
                views.append(self.sheet_view.to_tree())
                xf.write(views)
                xf.write(write_format(self))

                cols = write_cols(self)
                if cols is not None:
                    xf.write(cols)

                with xf.element("sheetData"):
                    try:
                        while True:
                            r = (yield)
                            xf.write(r)
                    except GeneratorExit:
                        pass
                if self.protection.sheet:
                    prot = Element('sheetProtection', dict(self.protection))
                    xf.write(prot)
                af = write_autofilter(self)
                if af is not None:
                    xf.write(af)
                dv = write_datavalidation(self)
                if dv is not None:
                    xf.write(dv)
                if self._comments:
                    comments = Element('legacyDrawing', {'{%s}id' % REL_NS: 'commentsvml'})
                    xf.write(comments)
Example #4
0
def write_properties(worksheet):
    wsp = worksheet.sheet_properties
    pr = write_sheetPr(wsp)
    return pr
Example #5
0
def write_properties(worksheet):
    wsp = worksheet.sheet_properties
    pr = write_sheetPr(wsp)
    return pr