Ejemplo n.º 1
0
    def cell_to_value(self, cell, row_id):
         
        if self.document.config.headers and row_id == 0:
            css_like_style = self.document.config.header_style
        elif  len(self.document.config.row_styles) == 0:
            css_like_style = ''
        else:
            style_index = row_id % len(self.document.config.row_styles)
            css_like_style = self.document.config.row_styles[style_index]

        style = self.convert_style(css_like_style)
        
        if type(cell) == model_base.HeaderFieldType:
            style = self.convert_style(self.document.config.header_style)
            return cell.data, style

        elif type(cell) in (model_base.IntFieldType, model_base.StringFieldType):
            return cell.data, style

        elif type(cell) == model_base.DateTimeFieldType:
            style.num_format_str = self.document.config.get('datetime_format', 'M/D/YY h:mm')
            return cell.data, style
        elif type(cell) == model_base.DateFieldType:
            num_string_format = self.document.config.get('date_format', 'M/D/YY')
            if cell.format:
                num_string_format = to_excel_from_C_codes(cell.format, self.document.config)
            style.num_format_str = num_string_format
            return cell.data, style

        else:
            return cell.data, style
Ejemplo n.º 2
0
    def cell_to_value(self, cell, row_id):

        if self.document.config.headers and row_id == 0:
            css_like_style = self.document.config.header_style
        elif len(self.document.config.row_styles) == 0:
            css_like_style = ''
        else:
            style_index = row_id % len(self.document.config.row_styles)
            css_like_style = self.document.config.row_styles[style_index]

        style = self.convert_style(css_like_style)

        if type(cell) == model_base.HeaderFieldType:
            style = self.convert_style(self.document.config.header_style)
            return cell.data, style

        elif type(cell) in (model_base.IntFieldType, model_base.StringFieldType):
            return cell.data, style

        elif type(cell) == model_base.DateTimeFieldType:
            style.num_format_str = self.document.config.get('datetime_format', 'M/D/YY h:mm')
            return cell.data, style
        elif type(cell) == model_base.DateFieldType:
            num_string_format = self.document.config.get('date_format', 'M/D/YY')
            if cell.format:
                num_string_format = to_excel_from_C_codes(cell.format, self.document.config)
            style.num_format_str = num_string_format
            return cell.data, style

        else:
            return cell.data, style
Ejemplo n.º 3
0
    def cell_to_value(self, cell):
         
        style = self.convert_style(self.document.config.row_styles[0])
        
        if type(cell) == model_base.HeaderFieldType:
            style = self.convert_style(self.document.config.header_style)
            return cell.data, style

        elif type(cell) in (model_base.IntFieldType, model_base.StringFieldType):
            return cell.data, style

        elif type(cell) == model_base.DateTimeFieldType:
            style.num_format_str = self.document.config.get('datetime_format', 'M/D/YY h:mm')
            return cell.data, style
        elif type(cell) == model_base.DateFieldType:
            num_string_format = self.document.config.get('date_format', 'M/D/YY')
            if cell.format:
                num_string_format = to_excel_from_C_codes(cell.format, self.document.config)
            style.num_format_str = num_string_format
            return cell.data, style
        
        return "", style