首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >openpyxl对齐缩进vs ident

openpyxl对齐缩进vs ident
EN

Stack Overflow用户
提问于 2015-06-10 11:41:52
回答 1查看 1.3K关注 0票数 0

在我的Excel文件中,单元格中的数据是缩进的,而缩进信息的获取是非常重要的。

我的代码:

代码语言:javascript
复制
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为增量

EN

回答 1

Stack Overflow用户

发布于 2015-06-10 15:07:41

我不知道您使用的是什么版本的openpyxl,但是ident从来都不是一个对齐属性。c.alignment是首选拼写。该规范这样定义了indent

代码语言:javascript
复制
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.
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30746699

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档