Exemplo n.º 1
0
Arquivo: stats.py Projeto: 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)
Exemplo n.º 2
0
    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)