def _style_range(self, cell, cell_range, border=None, fill=None, font=None, alignment=None):
        """
        Apply styles to a range of cells as if they were a single cell.

        :param ws:  Excel worksheet instance
        :param range: An excel range to style (e.g. A1:F20)
        :param border: An openpyxl Border
        :param fill: An openpyxl PatternFill or GradientFill
        :param font: An openpyxl Font object
        """

        from openpyxl.styles import Border, Side

        top = left = right = bottom = Side(border_style='thin', color=self.border_color)

        def border_add(border, top=None, right=None, left=None, bottom=None):
            top = top or border.top
            left = left or border.left
            right = right or border.right
            bottom = bottom or border.bottom
            return Border(top=top, left=left, right=right, bottom=bottom)

        cell.alignment = alignment
        cell.fill = fill

        rows = list(self.sheet[cell_range])

        for cell in rows[0]:
            cell.border = border_add(cell.border, top=top)
        for cell in rows[-1]:
            cell.border = border_add(cell.border, bottom=bottom)

        for row in rows:
            l = row[0]
            r = row[-1]
            l.border = border_add(l.border, left=left)
            r.border = border_add(r.border, right=right)
Apply styles to a range of cells as if they were a single cell.

        :param ws:  Excel worksheet instance
        :param range: An excel range to style (e.g. A1:F20)
        :param border: An openpyxl Border
        :param fill: An openpyxl PatternFill or GradientFill
        :param font: An openpyxl Font object