# -*- coding: utf-8 -*-
# @Time    : 2019-11-21 3:05
# @Author  : kbsonlong
# @Email   : kbsonlong@gmail.com
# @Blog    : www.alongparty.cn
# @File    : utils.py
# @Software: PyCharm

import xlwt


class CellWriter(object):
    def __init__(self, name):
        self.file_name = name
        self.workbook = xlwt.Workbook(encoding='utf-8')

    #         for sh in args:
    #             self.worksheet = self.workbook.add_sheet(sh)

    def fontStyle(self):
        font = xlwt.Font()
        font.name = u"微软雅黑"
        #         font.height = 20 * 12
        return font

    def borderStyle(self):
        borders = xlwt.Borders()
        borders.left = 1
        borders.right = 1
        borders.top = 1
        borders.bottom = 1
        return borders

    def writeBanner(self, sheetName, bList):
        for ds in bList:
            sheetName.write(0, bList.index(ds), ds, self.bodySttle(pattern=5))

    def bodySttle(self, pattern=None):
        style = xlwt.XFStyle()
        style.alignment.horz = 2
        style.alignment.vert = 1
        style.alignment.wrap = 1
        if pattern:
            pat = xlwt.Pattern()
            pat.pattern = xlwt.Pattern.SOLID_PATTERN
            pat.pattern_fore_colour = pattern
            style.pattern = pat
        style.font = self.fontStyle()
        style.borders = self.borderStyle()
        return style

    def save(self):
        self.workbook.save(self.file_name)

d131e1a1db4213ba257e2f97bd3d019b5233df55
<mask token>


class CellWriter(object):

    def __init__(self, name):
        self.file_name = name
        self.workbook = xlwt.Workbook(encoding='utf-8')
    <mask token>

    def borderStyle(self):
        borders = xlwt.Borders()
        borders.left = 1
        borders.right = 1
        borders.top = 1
        borders.bottom = 1
        return borders

    def writeBanner(self, sheetName, bList):
        for ds in bList:
            sheetName.write(0, bList.index(ds), ds, self.bodySttle(pattern=5))
    <mask token>

    def save(self):
        self.workbook.save(self.file_name)

<mask token>


class CellWriter(object):

    def __init__(self, name):
        self.file_name = name
        self.workbook = xlwt.Workbook(encoding='utf-8')
    <mask token>

    def borderStyle(self):
        borders = xlwt.Borders()
        borders.left = 1
        borders.right = 1
        borders.top = 1
        borders.bottom = 1
        return borders

    def writeBanner(self, sheetName, bList):
        for ds in bList:
            sheetName.write(0, bList.index(ds), ds, self.bodySttle(pattern=5))

    def bodySttle(self, pattern=None):
        style = xlwt.XFStyle()
        style.alignment.horz = 2
        style.alignment.vert = 1
        style.alignment.wrap = 1
        if pattern:
            pat = xlwt.Pattern()
            pat.pattern = xlwt.Pattern.SOLID_PATTERN
            pat.pattern_fore_colour = pattern
            style.pattern = pat
        style.font = self.fontStyle()
        style.borders = self.borderStyle()
        return style

    def save(self):
        self.workbook.save(self.file_name)

<mask token>


class CellWriter(object):

    def __init__(self, name):
        self.file_name = name
        self.workbook = xlwt.Workbook(encoding='utf-8')

    def fontStyle(self):
        font = xlwt.Font()
        font.name = u'微软雅黑'
        return font

    def borderStyle(self):
        borders = xlwt.Borders()
        borders.left = 1
        borders.right = 1
        borders.top = 1
        borders.bottom = 1
        return borders

    def writeBanner(self, sheetName, bList):
        for ds in bList:
            sheetName.write(0, bList.index(ds), ds, self.bodySttle(pattern=5))

    def bodySttle(self, pattern=None):
        style = xlwt.XFStyle()
        style.alignment.horz = 2
        style.alignment.vert = 1
        style.alignment.wrap = 1
        if pattern:
            pat = xlwt.Pattern()
            pat.pattern = xlwt.Pattern.SOLID_PATTERN
            pat.pattern_fore_colour = pattern
            style.pattern = pat
        style.font = self.fontStyle()
        style.borders = self.borderStyle()
        return style

    def save(self):
        self.workbook.save(self.file_name)

import xlwt


class CellWriter(object):

    def __init__(self, name):
        self.file_name = name
        self.workbook = xlwt.Workbook(encoding='utf-8')

    def fontStyle(self):
        font = xlwt.Font()
        font.name = u'微软雅黑'
        return font

    def borderStyle(self):
        borders = xlwt.Borders()
        borders.left = 1
        borders.right = 1
        borders.top = 1
        borders.bottom = 1
        return borders

    def writeBanner(self, sheetName, bList):
        for ds in bList:
            sheetName.write(0, bList.index(ds), ds, self.bodySttle(pattern=5))

    def bodySttle(self, pattern=None):
        style = xlwt.XFStyle()
        style.alignment.horz = 2
        style.alignment.vert = 1
        style.alignment.wrap = 1
        if pattern:
            pat = xlwt.Pattern()
            pat.pattern = xlwt.Pattern.SOLID_PATTERN
            pat.pattern_fore_colour = pattern
            style.pattern = pat
        style.font = self.fontStyle()
        style.borders = self.borderStyle()
        return style

    def save(self):
        self.workbook.save(self.file_name)

# -*- coding: utf-8 -*-
# @Time    : 2019-11-21 3:05
# @Author  : kbsonlong
# @Email   : kbsonlong@gmail.com
# @Blog    : www.alongparty.cn
# @File    : utils.py
# @Software: PyCharm

import xlwt


class CellWriter(object):
    def __init__(self, name):
        self.file_name = name
        self.workbook = xlwt.Workbook(encoding='utf-8')

    #         for sh in args:
    #             self.worksheet = self.workbook.add_sheet(sh)

    def fontStyle(self):
        font = xlwt.Font()
        font.name = u"微软雅黑"
        #         font.height = 20 * 12
        return font

    def borderStyle(self):
        borders = xlwt.Borders()
        borders.left = 1
        borders.right = 1
        borders.top = 1
        borders.bottom = 1
        return borders

    def writeBanner(self, sheetName, bList):
        for ds in bList:
            sheetName.write(0, bList.index(ds), ds, self.bodySttle(pattern=5))

    def bodySttle(self, pattern=None):
        style = xlwt.XFStyle()
        style.alignment.horz = 2
        style.alignment.vert = 1
        style.alignment.wrap = 1
        if pattern:
            pat = xlwt.Pattern()
            pat.pattern = xlwt.Pattern.SOLID_PATTERN
            pat.pattern_fore_colour = pattern
            style.pattern = pat
        style.font = self.fontStyle()
        style.borders = self.borderStyle()
        return style

    def save(self):
        self.workbook.save(self.file_name)
