示例#1
0
文件: stats.py 项目: nursix/eden
    def write(self, sheet, rowindex, colindex, label, style="odd"):
        """
            Write a label/value into the XLS worksheet

            @param sheet: the worksheet
            @param rowindex: the row index
            @param colindex: the column index
            @param label: the label/value to write
            @param style: style name (S3XLS styles)
        """

        styles = self.styles
        if not styles:
            self.styles = styles = S3XLS._styles()

        style = styles.get(style)
        if not style:
            import xlwt
            style = xlwt.XFStyle()

        label = s3_str(label)

        # Adjust column width
        col = sheet.col(colindex)
        curwidth = col.width or 0
        adjwidth = max(len(label) * 240, 2480) if label else 2480
        col.width = max(curwidth, adjwidth)

        row = sheet.row(rowindex)
        row.write(colindex, label, style)
示例#2
0
文件: stats.py 项目: riginoommen/eden
    def write(self, sheet, rowindex, colindex, label, style="odd"):
        """
            Write a label/value into the XLS worksheet

            @param sheet: the worksheet
            @param rowindex: the row index
            @param colindex: the column index
            @param label: the label/value to write
            @param style: style name (S3XLS styles)
        """

        styles = self.styles
        if not styles:
            self.styles = styles = S3XLS._styles()

        style = styles.get(style)
        if not style:
            import xlwt
            style = xlwt.XFStyle()

        label = s3_str(label)

        # Adjust column width
        col = sheet.col(colindex)
        curwidth = col.width or 0
        adjwidth = max(len(label) * 240, 2480) if label else 2480
        col.width = max(curwidth, adjwidth)

        row = sheet.row(rowindex)
        row.write(colindex, label, style)