Pptxgenjs: Complex Text Elements and Lists

Created on 14 Nov 2017  路  3Comments  路  Source: gitbrent/PptxGenJS

Hi,
Is it possible to create a list with multiple indent levels and rich text inside each list item?
I am trying to create something like:

  • normal list item with bold text and _italic_ inside
  • another list item

(example attached)

Thanks,
Adrian

screenshot-2017-11-14-13-52-24-750

enhancement question

All 3 comments

Ok, so after some more digging and research I managed to create the list, with Linetrough and different bullet colors using a workaround to create the first text element that contain the bullet option as an empty space " ". It's not the perfect workaround since it will add a space in front of the text, but it's acceptable for my needs for the moment. Also, I didn't see any Linetrough option, so I took the liberty to add this in the options list by adding the following line in genXmlTextRun:

startInfo += ( opts.strike    ? ' strike="sngStrike"' : '' );

Also, the code used for the list in case that others might need it:

slide.addText([
    {text: ' ', options: {font_size: 18, font_face: 'Arial', color: 'FF0000', bullet:{code:'25A0'}}},
    {text: 'asd', options: {font_size: 18, font_face: 'Arial', color: '0000FF'}},
    {text: 'asd', options: {font_size: 18, font_face: 'Arial', color: '0000FF', bold: true, underline: true}},
    {text: 'a', options: {font_size: 18, font_face: 'Arial', color: 'FF0000', bold: true, underline: true}},
    {text: 'sd', options: {font_size: 18, font_face: 'Arial', color: 'FF0000'}},
    {text: 'a', options: {font_size: 18, font_face: 'Arial', color: '000000', bullet:{code:'25CF'}, indentLevel: 2}},
    {text: 'sda', options: {font_size: 18, font_face: 'Arial', color: 'F900F0', strike:true}},
    {text: ' ', options: {font_size: 18, font_face: 'Arial', color: '00FF00', bullet:{code:'25A0'}, indentLevel: 1}},
    {text: 'sdas', options: {font_size: 18, font_face: 'Arial', color: '000000'}},
    {text: 'd', options: {font_size: 18, font_face: 'Arial', color: '00FF00'}}
  ], {x: 0.5, y: 2.0, w: 6, h: 2.25, margin: 0.1}
);

And the PPT results in attached image.
complex_lists_different_bullet_color_done

Best Regards,
Adrian

Thanks for example @adrienco88 !

I've incorporated your code and the text option strike is now available.

Was this page helpful?
0 / 5 - 0 ratings