简体   繁体   English

Python。 如何从 xlsx 文件中获取格式样式

[英]Python. How to get formatting styles from xlsx file

Good afternoon.下午好。 I have a file... For example, in this file there are 4 identical sentences, but they have different formatting styles.我有一个文件... 例如,在这个文件中有 4 个相同的句子,但它们具有不同的格式样式。

  1. In the first sentence, one word is in bold在第一句话中,一个单词是粗体的
  2. In the second sentence, one word is highlighted in red在第二句中,一个单词以红色突出显示
  3. In the third sentence, one word is oversized (say 16px instead of 10px)在第三句中,一个词过大(比如 16px 而不是 10px)
  4. No different.没有区别。

How can you parse this file and get the data starting with what letter the text formatting begins and what letter this formatting ends with?如何解析此文件并获取以文本格式开头的字母和格式结尾的字母开头的数据? And what kind of formatting (color, font size, etc.)以及什么样的格式(颜色、字体大小等)

All this needs to be done in Python.所有这些都需要在 Python 中完成。

您可以查看openpyxl库,其中有一个使用样式可能是您需要的部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM