Openpyxl: Determining which character in a cell va

2019-07-21 11:20发布

I'll first mention that I'm using Python 2.7 and Openpyxl 2.4.1

Essentially I have a sheet in a workbook that I'm cleaning. I'm going through each cell and checking if there is Strikethrough text. Assume I'm looking in Column A:

for i in range(1, sheet.max_row+1):
    my_cell = sheet['A'+str(i)]
    if my_cell.font.strikethrough == True:
        #here's the tricky part

I know that it is possible to determine whether or not a cell contains strikethrough characters, but I would like to find which characters in the cell.value are strikethrough characters. I've read the docs and couldn't find too much on this. Is this possible with openpyxl?

1条回答
forever°为你锁心
2楼-- · 2019-07-21 11:30

No this is not possible: openpyxl does not deal with formatting below the level of the cell. You will need to write your own parser to do this.

查看更多
登录 后发表回答