xlrd python:获取粗体格式

时间:2016-07-06 09:21:22

标签: python xlrd

我尝试在python中确定行中的条目是否为粗体。但是xf_index的返回值是none。如何确定单元格是否为粗体?

import xlrd

fileLocation = "location"
workbook = xlrd.open_workbook(fileLocation)
sheet = workbook.sheet_by_index(0) 

workbook.formatting_info = True

for row in range(sheet.nrows):

if sheet.cell_value(row,4)!= "" :
    currentRow = row
    currentCell = sheet.cell(currentRow,4)
    #print(sheet.cell(currentRow,4).xf_index) -> returns none

    attributeName = sheet.cell_value(row, 4)
    attributeValue = sheet.cell_value(row,8)
    line = "["+attributeName+ attributeValue+"]"

0 个答案:

没有答案