PptxGenJS icon indicating copy to clipboard operation
PptxGenJS copied to clipboard

[FEATURE] Make `addText` remove unsupported Unicode characters

Open AndreasNasman opened this issue 1 year ago • 1 comments

We appreciate your feedback - to help the team understand your needs please complete the following template to ensure we have the details to help.

Submission Guidelines

  • If you are not using the latest release, please update and see if the issue is resolved before submitting an issue
  • General questions or high-level topics should be posted in Discussions
  • Please browse the online Documentation to see if your question is already addressed there

Issue Category

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

Product Versions

  • Please specify what version of the library you are using......: 3.11.0
  • Please specify what version(s) of PowerPoint you are targeting: Microsoft® PowerPoint® for Microsoft 365 MSO (Version 2303 Build 16.0.16227.20202) 64-bit
  • Please specify what web browser you are using.................: Microsoft Edge

Desired Behavior

It would be great if slide.addText removed or replaced unsupported Unicode characters in Powerpoint. This functionality could be enabled by default or a separate option to enable it could be implemented. A warning that unsupported Unicode characters were found in the added text would also be helpful.

For example, adding text containing a line tabulation character results in a broken PPT document.

import PptxGenJS from 'pptxgenjs';

const presentation = new PptxGenJS();
const slide = presentation.addSlide();

// Adding text containing a line tabulation character (\v) produces a broken PPT document.
slide.addText('Hello\vWorld!');
slide.addText([{ text: 'Hello\vWorld!' }]);

presentation.writeFile({ fileName: 'Sample Presentation.pptx' });

AndreasNasman avatar Apr 20 '23 09:04 AndreasNasman