コード例 #1
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
                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)
コード例 #2
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)
コード例 #3
0
ファイル: dump_worksheet.py プロジェクト: theorchard/openpyxl
    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)
コード例 #4
0
ファイル: worksheet.py プロジェクト: indoorvoice/WiFinder
def write_properties(worksheet):
    wsp = worksheet.sheet_properties
    pr = write_sheetPr(wsp)
    return pr
コード例 #5
0
ファイル: worksheet.py プロジェクト: IHMEC/app-template
def write_properties(worksheet):
    wsp = worksheet.sheet_properties
    pr = write_sheetPr(wsp)
    return pr