当前位置: 首页>>代码示例>>Python>>正文


Python utils.get_column_letter方法代码示例

本文整理汇总了Python中openpyxl.utils.get_column_letter方法的典型用法代码示例。如果您正苦于以下问题:Python utils.get_column_letter方法的具体用法?Python utils.get_column_letter怎么用?Python utils.get_column_letter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openpyxl.utils的用法示例。


在下文中一共展示了utils.get_column_letter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _set_cells_style

# 需要导入模块: from openpyxl import utils [as 别名]
# 或者: from openpyxl.utils import get_column_letter [as 别名]
def _set_cells_style(self):
        """
        将样式应用到所有 cell 中 
        """
        max_row, max_column = self.sheet.max_row + 1, self.sheet.max_column + 1
        for r in range(1, max_row):
            self.sheet.row_dimensions[r].height = Config.cell_height
            for c in range(1, max_column):
                letter = get_column_letter(c)
                title = letter + str(r)
                self._set_cell_style(self.sheet[title], title)
                self.sheet.column_dimensions[letter].width = Config.cell_width[letter] 
开发者ID:appcell,项目名称:OverwatchDataAnalysis,代码行数:14,代码来源:sheet1.py

示例2: column_letter

# 需要导入模块: from openpyxl import utils [as 别名]
# 或者: from openpyxl.utils import get_column_letter [as 别名]
def column_letter(self):
        return get_column_letter(self.column_index) 
开发者ID:SverkerSbrg,项目名称:openpyxl-templates,代码行数:4,代码来源:columns.py

示例3: coordinate

# 需要导入模块: from openpyxl import utils [as 别名]
# 或者: from openpyxl.utils import get_column_letter [as 别名]
def coordinate(self):
        column = get_column_letter(self.column)
        return "{1}{0}".format(self.row, column) 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:5,代码来源:read_only.py

示例4: save_workbook

# 需要导入模块: from openpyxl import utils [as 别名]
# 或者: from openpyxl.utils import get_column_letter [as 别名]
def save_workbook(self):
		for worksheet in self.workbook._sheets:
			for col in worksheet.columns:
				max_length = 0
				column = get_column_letter(col[0].column)  # Get the column name
				for cell in col:
					try:  # Necessary to avoid error on empty cells
						if len(str(cell.value)) > max_length:
							max_length = len(cell.value)
					except:
						pass
				adjusted_width = (max_length + 2) * 1.2
				worksheet.column_dimensions[column].width = adjusted_width
		self.workbook.save(self.filename) 
开发者ID:BloodHoundAD,项目名称:BloodHound-Tools,代码行数:16,代码来源:bloodhoundanalytics.py

示例5: createWorksheet

# 需要导入模块: from openpyxl import utils [as 别名]
# 或者: from openpyxl.utils import get_column_letter [as 别名]
def createWorksheet(wb):
    # "creating register"
    global NAMES, ROLLS, NUMBER_OF_STUDENTS
    manth = month()
    ws = wb.create_sheet(manth)
    ws.merge_cells('A1:AN2')
    heading = 'Attendance Record for ' + manth
    heading = heading + ' ' * 50 + heading + ' ' * 50 + heading
    ws['A1'] = heading
    ws['A1'].font = HEADING_FONT
    ws['A1'].alignment = ALIGNMENT

    # ws.sheet_properties.tabColor = 'FFFF66'
    ws['A3'] = 'S.No'
    ws['B3'] = 'Enrollment'
    ws['B3'].fill = FILL_ROLL
    ws.merge_cells('C3:D3')
    ws['C3'] = 'Name'
    ws['C3'].fill = FILL_NAME

    cellrange = 'A' + str(GAP - 1) + ':AN' + str(GAP - 1)
    set_border(ws, cellrange)
    for i in range(NUMBER_OF_STUDENTS):
        ws.merge_cells(start_row=GAP + i, start_column=3, end_row=GAP + i, end_column=4)
        ws.cell(row=GAP + i, column=1, value=str(i + 1))
        ws.cell(row=GAP + i, column=2, value=ROLLS[i]).fill = FILL_ROLL
        ws.cell(row=GAP + i, column=3, value=NAMES[i]).fill = FILL_NAME

        cellrange = 'A' + str(GAP + i) + ':AN' + str(GAP + i)
        set_border(ws, cellrange)
    today = todays_date()
    first_day = date(today.year, today.month, 1)
    days_in_month = monthrange(today.year, today.month)[1]
    for i in range(days_in_month):
        dt = first_day + timedelta(days=i)
        ws.cell(row=3, column=DATE_COLUMN + i, value=dt).fill = FILL_DATE

    first_date_column = get_column_letter(DATE_COLUMN)
    last_date_column = get_column_letter(DATE_COLUMN + days_in_month - 1)
    sum_cell_column = DATE_COLUMN + days_in_month + 1
    ws.cell(row=3, column=sum_cell_column, value="Total").fill = FILL_TOTAL
    for i in range(NUMBER_OF_STUDENTS):
        ws.cell(row=GAP + i, column=sum_cell_column,
                value="=SUM(" + first_date_column + str(GAP + i) + ":" + last_date_column + str(
                    GAP + i) + ")").fill = FILL_TOTAL 
开发者ID:Marauders-9998,项目名称:Attendance-Management-using-Face-Recognition,代码行数:47,代码来源:excel.py


注:本文中的openpyxl.utils.get_column_letter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。