Skip to content

BUG: When two tables are set to autopage on the same slide, positioning can be incorrect #1472

Description

@Mathlete-101

Issue Category

  • Enhancement
  • Bug
  • Question
  • Documentation gap/issue

Product Versions

  • Please specify what version of the library you are using......: [4.0.1]
  • Please specify what version(s) of PowerPoint you are targeting: [ 2606 ]
  • Please specify what web browser you are using.................: [ Chrome 150.0.7871.187 ]

Desired Behavior

When creating a powerpoint with two tables, side by side, that have autopage enabled, each one will generate new pages when it gets to the bottom of its slide

Observed Behavior

When one table reaches the bottom, it creates a new page correctly, but then the other table will have its y position set to the new page y value for the table rather than going where it is told

Steps to Reproduce

  • create a new slide and add two tables to it, each taking up about half of the slide horizontally. set the y position to be about halfway down the slide for both tables
  • enable autopage on both slides
  • add a large number of items to the first table, and a few to the second
    expected: there are two pages. the second page has the overflowing items from the first table. On the first page, the two tables' tops are vertically aligned, and there is a large empty space at the top of the first slide
    actual: the first table pages correctly. the second table has the wrong y height on the first slide.

Code analysis

without looking too much into it, I would guess the issue is here in src/gen-tables.ts:

function calcSlideTabH(): void {
		let emuStartY = 0
		if (tableRowSlides.length === 0) emuStartY = tablePropY || inch2Emu(arrInchMargins[0])
		if (tableRowSlides.length > 0) emuStartY = inch2Emu(tableProps.autoPageSlideStartY || tableProps.newSlideStartY || arrInchMargins[0])

whether emuStartY is determined by tablePropY or tableProps.autoPageSlideStartY || tableProps.newSlideStartY is based on whether there are additional slides in tableRowSlides or not. While I haven't verified this, I suspect that if both tables overflow and have to spill onto another slide, they will each generate a separate slide instead of sharing. Instead, each table should track the number of slides that it needs to spill onto independently, and create those slides if they do not already exist rather than using the number of slides already created as the current slide number for that table, so that multiple tables can be accounted for correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions