Pptxgenjs: [BUG] addNotes function adding notes as an array of objects, parsed as [object Object] in notes field

Created on 21 Apr 2021  路  2Comments  路  Source: gitbrent/PptxGenJS

Category

  • [ ] Enhancement
  • [x] Bug
  • [ ] Question
  • [ ] Documentation gap/issue

Version

Please specify what version of the library you are using: 3.5.0

Please specify what version(s) of PowerPoint you are targeting: Powerpoint Online, Google Slides (they show identical behavior)

Expected / Desired Behavior

addNotes should result in text notes in the Notes field of the Powerpoint file.

Observed Behavior

addNotes function with any string results in [object Object] in the note field in any reader I've tried it in.

Steps to Reproduce

  1. use addNotes function to add any string to a pptxgen presentation.
  2. trigger save presentation
  3. open in either Powerpoint Online or Google Slides (possibly in Powerpoint itself?)
  4. note [object Object] in the field

Here is a slightly modified version of the demo fiddle which replicates this behavior: https://jsfiddle.net/zj5m21ba/0/

Here is another version of the demo fiddle that bypasses addNotes but successfully generates notes: https://jsfiddle.net/zj5m21ba/1/

bug

All 2 comments

I noticed the same issue yesterday after updating. It looks like the function was updated as part of the addTextDefinition update that took place for 3.5.0.

Updated function:

function addNotesDefinition(target, notes) {
    target._slideObjects.push({
        _type: SLIDE_OBJECT_TYPES.notes,
        text: [{ text: notes }],
    });
}

All the downstream code still seems to be expecting a string though, so reverting back to the following restores the previous behaviour:

function addNotesDefinition(target, notes) {
    target._slideObjects.push({
        _type: SLIDE_OBJECT_TYPES.notes,
        text: notes,
    });
}

Thanks @karlolsonuc and @ReimaFrgos

Whoops. I neglected to check Notes functionality before v.3.5.0 was released.

Fixed now:
Screen Shot 2021-04-22 at 22 21 48

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Slidemagic picture Slidemagic  路  4Comments

simonjcarr picture simonjcarr  路  6Comments

Alexiz-Padilla picture Alexiz-Padilla  路  5Comments

bestis picture bestis  路  6Comments

sangramjagtap picture sangramjagtap  路  6Comments