OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
690 stars 95 forks source link

A shape's position and size does not accept floating numbers #4178

Open kerkues24 opened 9 months ago

kerkues24 commented 9 months ago

Provide required information needed to triage your issue

Your Environment

Expected behavior

The position and size parameters of a shape (left, top, width and height) should accept floating numbers.

Current behavior

When left, top, width or height of a shape in PowerPoint are set through JavaScript, all decimal places get lost. In Excel the last four places after the point are preserved.

Steps to reproduce

  1. Add a shape into PowerPoint presentation through JavaScript at shape.top=100.345574. The shape will be added at top=100.
  2. Place a shape by hand in the presentation. Get tempTop = shape.top and tempLeft = shape.left. Usually these are floating numbers with many decimal places. Reset shape.top = tempTop and shape.left = tempLeft. The decimal places get lost. The same happens with width and height.

Link to live example(s)

  1. Example gist in Script Lab

Context

Aligning, moving and resizing shapes in presentation through JavaScript is not accurately possible.

EsterBergen commented 8 months ago

Thanks @kerkues24 for raising this issue. We've added an item to the backlog and i'll provide an update here once available. Thanks again for the feedback!

mrflory commented 4 weeks ago

Hi @EsterBergen thanks for putting this to the backlog. I also came across this issue and found this ticket. Recently a new PPT API version 1.6 was released, but this issue is not fixed. Is there any update? Do we need to wait another ~2 year for the next API version to get a fix? Thanks.

EsterBergen commented 4 weeks ago

HI @mrflory - Thank you for the follow-up! This feature still on our backlog for consideration in future planning cycles. We'll provide updates here, when available.