RichText discussion (https://foss.heptapod.net/openpyxl/openpyxl/-/merge_requests/408)

55 views
Skip to first unread message

udif

unread,
Nov 15, 2021, 2:01:35 PM11/15/21
to openpyxl-users
I began a new codebase from the current 3.1 head.
I'm having an issue with the CellRichText class we discussed.
I'm trying to use the Serializable - derived classes, but the Sequence - based classes require all members to be of the same type.
In my case, CellRichText should have both str elements and TextBlock elements.

Charlie Clark

unread,
Nov 15, 2021, 2:15:35 PM11/15/21
to openpyxl-users

On 15 Nov 2021, at 20:01, udif wrote:

I began a new codebase from the current 3.1 head.

OK.

I'm having an issue with the CellRichText class we discussed.
I'm trying to use the Serializable - derived classes, but the Sequence -
based classes require all members to be of the same type.

Actually, expected_type should accept a tuple of types but I don't think I've used it yet. There are some parts of the schema that just don't map nicely.

In my case, CellRichText should have both str elements and TextBlock
elements.

I wouldn't use anything based on Serialisable for this: that is for parsing and serialising only and works most of time. Just write a Python class with a nice client-facing API as discussed, and then we can add the necessary code to convert the OOXML objects to this and then the other way round and takes the XML structure and strictures out of the picture.

Charlie

--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Waldlehne 23
Düsseldorf
D- 40489
Tel: +49-203-3925-0390
Mobile: +49-178-782-6226

udif

unread,
Nov 15, 2021, 4:05:53 PM11/15/21
to openpyxl-users
As I cannot change the branch of the original merge request, I have opened a new one on https://foss.heptapod.net/openpyxl/openpyxl/-/merge_requests/409 .
At the moment I've only added skeleton code to create rich text, and a few tests.
I will gradually add functionality to this branch.
Reply all
Reply to author
Forward
0 new messages