PptxGenJS icon indicating copy to clipboard operation
PptxGenJS copied to clipboard

[BUG] Inside a table cell, a text mixed with subscript/superscript renders on multiple lines instead of one

Open StevePires opened this issue 1 year ago • 1 comments

Issue Category

  • [ x ] Bug

Product Versions

  • version of the library: v3.12.0 (Angular 14 (typescript)
  • version(s) of PowerPoint you are targeting: any (same result on LibreOffice Impress)
  • web browser: Does not seem relevant (tested on both Firefox 117.0.1 & Chrome 118)

Desired Behavior

Inside a table cell, inserting a text composed of multiple texts, each one should stay on the same line, for instance. For example: composing with this: "42cm" +" ³ " + " is a small cube" should be rendered on only one line: 42cm³ is a small cube

Observed Behavior

The result in the table cells are rendered on 3 lines like this:

42cm
³
 is a small cube

Other example:

1.5 liters of H
2
O is the quantity recommended to drink per day!

(note: the '2' it is rendered in 'sub' correctly, I just don't know how to render it here)

Steps to Reproduce

const pres = new pptxgen();
const slide = pres.addSlide();

dataRow = [
          {
            text: [
              { text: '42 cm' },
              { text: '3', options: { superscript: true } },
              { text: ' is a small cube' }
            ]
          },
          {
            text: [
              { text: '1.5 liters of H' },
              { text: '2', options: { subscript: true } },
              { text: 'O is the quantity recommended to drink per day!' }
            ]
          },
          { text: 'By the way, how are you doing today?' }
];

slide.addTable(dataRow, { x: 1, y: 1, rowH: 0.4, fontSize: 10 });

StevePires avatar Oct 18 '23 14:10 StevePires