在我的Excel文件中,单元格中的数据是缩进的,而缩进信息的获取是非常重要的。
我的代码:
import openxlpy as opxl
wb = opxl.load_workbool('file.xlsx')
sh = wb.get_active_sheet()
r = sh.rows
c = r[10][0]现在的问题是: c.style.alignment给了我两个选项(1)缩进和(2)标识
(%1)未返回正确的缩进信息(%2)具有正确的数字
两者之间的区别是什么?ident有正确的信息是正常的吗?
谢谢
更新
openpyxl版本是1.8.5。文本表示一棵树,其中每个缩进都是下一级。它从没有缩进开始,以1为增量
发布于 2015-06-10 15:07:41
我不知道您使用的是什么版本的openpyxl,但是ident从来都不是一个对齐属性。c.alignment是首选拼写。该规范这样定义了indent:
An integer value, where an increment of 1 represents 3 spaces. Indicates the number of spaces (of the normal style font) of indentation for text in a cell. The number of spaces to indent is calculated as following:
Number of spaces to indent = indent value * 3
[Example:For example, an indent value of 1 means that the text begins 3 space widths (of the normal style font) from the edge of the cell.
end example]
[Note: The width of one space character is defined by the font. end note] Only left, right, and distributed horizontal alignments are supported.
The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.https://stackoverflow.com/questions/30746699
复制相似问题