Skip to content
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

[BUG] addShape : cannot read properties of undefined (reading 'rect') #1352

Open
2 of 4 tasks
ghaccenta opened this issue Sep 23, 2024 · 0 comments
Open
2 of 4 tasks

Comments

@ghaccenta
Copy link

ghaccenta commented Sep 23, 2024

Issue Category

  • Enhancement
  • Bug
  • Question
  • Documentation gap/issue

Product Versions

  • Please specify what version of the library you are using......: [3.12.0]
  • Please specify what version(s) of PowerPoint you are targeting: [ ]
  • Please specify what web browser you are using.................: [Chromium 128.0.6613.84 ]

Desired/Observed Behavior

I am trying to draw a rectangle shape in my slide, but I get a "cannot read properties of undefined (reading 'rect')" error instead. It seems the enum of shapes isn't properly loaded in the library : when I console.log(pptxgen.ShapeType), I get undefined.

Steps to Reproduce

I am using the latest version of the library (3.12.0) with an angular 17 project in typescript. So far the library worked very well, but I stumbled across an issue I haven't figured out how to solve yet.

Here's my (simplified) code :

import pptxgen from 'pptxgenjs';

export class SlideService {
    public drawRect(slide: pptxgen.Slide) : void {
        slide.addShape(pptxgen.ShapeType.rect, {
            x: 1.0,
            y: 1.0,
            w: 2.0,
            h: 1.0,
            fill: { color: 'ffffff' },
            line: { color: '000000', width: 1 }
        });
    }
}

Did I miss something from the documentation ? https://gitbrent.github.io/PptxGenJS/docs/api-shapes/
Is this a bug ?

Edit : If I instead write the string "rect" directly instead of using the enum, it works as expected.

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

No branches or pull requests

1 participant