[英]How to set row height using Python xlwings
我使用 Python xlwings 向現有的 Excel 工作表添加了新工作表。 我想在新工作表中將行高設置為 15。 我怎樣才能做到這一點。?
到目前為止你還沒有辦法在 xlwings 中做到這一點,但如果你可以用 openpyxl 做到這一點, 這里是更好地理解的鏈接
# import openpyxl module
import openpyxl
# Call a Workbook() function of openpyxl
# to create a new blank Workbook object
wb = openpyxl.Workbook()
# Get workbook active sheet
# from the active attribute.
sheet = wb.active
# writing to the specified cell
sheet.cell(row = 1, column = 1).value = ' hello '
sheet.cell(row = 2, column = 2).value = ' everyone '
# set the height of the row
sheet.row_dimensions[1].height = 70
# set the width of the column
sheet.column_dimensions['B'].width = 20
# save the file
wb.save('dimension.xlsx')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.