Skip to content

Fix Anchor Column and Row Positioning by Adjusting Scaling for Excel Defaults #2924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stany-bns
Copy link

…faults

Previously colWidth and rowHeight assumed a simplistic scaling factor, causing incorrect image and object positioning when custom widths/heights were set.

This update uses accurate scaling:

  • 8.43 width = 640000 EMUs
  • 15 height = 180000 EMUs
    This pull request includes several changes aimed at improving code readability and accuracy in calculations, as well as adding a new test for image positioning with custom column widths. The most important changes include refactoring calculation logic in the Anchor class, simplifying test assertions, and introducing a new integration test for image positioning.

Codebase Improvements

  • Refactored calculation logic in Anchor class: Updated column width and row height calculations to use more precise scaling factors for better accuracy. (lib/doc/anchor.js: [1] [2] [3]

  • Simplified test assertions: Replaced multiline assertions with single-line equivalents for better readability in the test suite. (spec/integration/workbook-xlsx-reader.spec.js: [1] [2] [3]

Testing Enhancements

  • New integration test for image positioning: Added a test to verify that images are positioned correctly when custom column widths are set. (spec/integration/workbook/images.spec.js: spec/integration/workbook/images.spec.jsR292-R338)

  • Updated unit tests for Anchor class: Adjusted tests to reflect the new scaling factors in column width and row height calculations. (spec/unit/doc/anchor.spec.js: [1] [2] [3]

These changes collectively improve the maintainability and accuracy of the codebase while enhancing test coverage.

Improves placement precision for images and anchored objects.

Summary

Test plan

Related to source code (for typings update)

…faults

Previously colWidth and rowHeight assumed a simplistic scaling factor,
causing incorrect image and object positioning when custom widths/heights were set.

This update uses accurate scaling:
- 8.43 width = 640000 EMUs
- 15 height = 180000 EMUs

Improves placement precision for images and anchored objects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant