Exception opening a file due to pitchFamily validation
Created originally on Bitbucket by crowdds (Paul Traynier)
Hi. First off, thank you for the great python package.
I have an issue in opening one Excel file (sent from China - it seems to be more common in files from Asia) in that just opening the file raises an exception “Max value is 52”.
I get the exception just doing a
wb = load_workbook(filename=filename, data_only=True, keep_links=False)
I have traced this through to drawing/text.py line 104
pitchFamily = MinMax(min=0, max=52, allow_none=True)
My file has a pitchFamily value of 68. I don’t need the data that causes the error (it is text within a drawing region in the file), but the error means I cannot open the file to read out data I do want. An cut down example file with the issue is attached.
Searching around, I see it possible to have values larger than the hardcoded 52, but cannot find any official documentation on the exact usage. e.g.
https://qa.social.msdn.microsoft.com/Forums/en-US/1bf1f185-ee49-4314-94e7-f4e1563b5c00/finding-which-font-is-to-be-used-to-displaying-a-character-from-pptx-xml?forum=os_binaryfile has several examples up to 82.
http://www.tmssoftware.biz/flexcel/doc/net/api/FlexCel.Core/TPitchFamily.html also has up to 82.
I did find http://www.ecma.ch/activities/Office%20Open%20XML%20Formats/Draft%20ECMA-376%203rd%20edition,%20March%202011/Office%20Open%20XML%20Part%204%20-%20Transitional%20Migration%20Features.pdf, which provides specification up to 52 (I suspect the reason it’s set to be between 0 and 52 in the first place), but that just states “The possible values for this attribute are defined by the W3C XML Schema byte datatype”, which means between -128 and +127 according to https://www.w3.org/TR/xmlschema-2/#byte.
So I’m not sure if the fix is to change the MinMax to allow for up to 82, or just accept up to 127?
Attachments: Test_pitchFamily.xlsx