What is unit for column width?

126 views
Skip to first unread message

Polly

unread,
Sep 9, 2021, 9:11:57 AM9/9/21
to openpyxl-users
Hi,

After lots of digging around in the code and OpenXML documentation, I managed to find how can one get column width and row height from openpyxl;
However, I am having trouble understanding what is the metric unit that the width is saved as;
It seems like column height is in pixels; but the width is in sth else....
I found units.py file in the library and I see it has different conversations but yeah.. I am still very confused and OpenXML documentation (https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.column?view=openxml-2.8.1) is not really helpful either.

So, yeah, does anyone know what is unit used for column width in openpyxl?

Thanks!

Charlie Clark

unread,
Sep 9, 2021, 11:41:28 AM9/9/21
to openpyxl-users
Openpyxl uses the "native" units as covered by the specification: these are close to characters but depend upon actual font characteristics and OS settings. Basically, it's trial and error.

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
Reply all
Reply to author
Forward
0 new messages