dimanche 1 mars 2015

Editing workbooks with rich text in openpyxl

I was wondering if openpyxl can read and/or write rich text into excel. I am aware that this question was asked once before in 2012 linked below, but I am not sure if this has changed.


As it stands load_workbook() seems to throw away rich text formatting.


As for a specific problem, I need to open, edit, and save a workbook where some cells have both superscripted and normal text in one cell. When I save the workbook, the format of the first character of the cell is applied to the rest of the cell.


Here is the to 2012 question:

How do I find the formatting for a subset of text in an Excel document cell


After looking around, it seems like rich text was implemented in openpyxl (based on the issues list on openpyxl's bitbucket):

http://ift.tt/1wsHNZZ


But I am still unclear on how to use it (if I interpreted the issues list correctly at all). If it helps at all, I am actually not editing the contents of these cells simply that they don't lose formatting on save.


Any thoughts would be greatly appreciated.


Thanks! Best


Aucun commentaire:

Enregistrer un commentaire