MathNya / umya-spreadsheet

A pure rust library for reading and writing spreadsheet files
MIT License
238 stars 41 forks source link

Get Picture cropping info #164

Closed schungx closed 6 months ago

schungx commented 6 months ago

I have a spreadsheet with images that have been cropped.

I can see the following information regarding the cropping:

Picture.blip_fill -> BlipFill.source_rectangle -> SourceRectangle { t, l, r, b }

The measurements within SourceRectangle are all strings, which store a simple text representation of numbers.

How do I calculate the cropping offsets from this? Is there any documentation I can look up?

I can see that t = top, l = left, r = right and b = bottom... The numbers (represented as strings) do not quite match anything though...

MathNya commented 6 months ago

@schungx Thank you for contacting us. Sorry, I don't have the specs on the SourceRectangle values. According to this page, it seems to be a percentage. http://officeopenxml.com/drwPic-tile.php

schungx commented 6 months ago

Thanks a great deal.

Just knowing it may be a percentage already makes loads of sense.

schungx commented 6 months ago

It certainly looks like a percentage with three decimal digits, coded as a five-digit integer. Not sure why it is in text format (perhaps to have other values such as "auto" or something?)