The background isn’t strictly necessary for the question, but it might entertain.
Charts in financial markets are a mess: $ or € or £ or ¥ might be represented by different symbols on different charts. Indeed, sometimes different symbols in charts created by the same author and appearing on the same page. A consistent set of markers would allow readers to focus more on the meaning of the data, and less on the distraction of attempting to decode the markers. Such a set of 123 markers has been made, and will be open-sourced under the Boost licence.
These have been coded concisely into SVG. (Concisely: currently smallest is 157 bytes; median is 263 bytes; most verbose is 824 bytes.) Used as chart markers in Excel, typical size is to be about 10×10 pixels. Each SVG begins with something of the form < svg width='8.54737' height='11.6'…>
, the extra space being required to beat this BB’s defences. (Height rounded to reduce bytes; width computed from rounded height, and not rounded, so that aspect ratio is correct.)
They are imported into mac Excel 16.43 via a loop containing VBA resembling
Set sh = .Shapes.AddPicture(FileName:=…, LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=…)
sh.LockAspectRatio = msoTrue
Alas, Shapes.AddPicture seems to round the size of the picture to ½pt, which, for small things, can mess with the aspect ratios. I want my aspect ratios good, not wrong by ≈ ±½/10 ≈ ±5%.
Second attempt, is to specify Width:=200, Height=-1
. Alas, that destroys the aspect ratio, which becomes Ambassadors-style super-wide.
Third attempt is regenerates the SVGs, much wider: < svg width='854.737' height='1160'…>
, and import those. Aspect ratio deliciously accurate: hurray. But Excel attaches a PNG copy of the SVG, averaging about a million pixels, times 123 markers, is a file of 26 megabytes, which seems heavy penalty for the inclusion of 43k of SVG.
I’m stuck. Please, how Excel be persuaded to:
• Import a picture without rounding picture sizes.
• Import a picture without attaching a PNG copy?
Thank you.