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

Complex Text Elements and Lists #238

Closed
adrienco88 opened this issue Nov 14, 2017 · 3 comments
Closed

Complex Text Elements and Lists #238

adrienco88 opened this issue Nov 14, 2017 · 3 comments

Comments

@adrienco88
Copy link

adrienco88 commented Nov 14, 2017

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

@adrienco88
Copy link
Author

adrienco88 commented Nov 14, 2017

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

@gitbrent
Copy link
Owner

Thanks for example @adrienco88 !

gitbrent pushed a commit that referenced this issue Nov 15, 2017
@gitbrent
Copy link
Owner

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

@gitbrent gitbrent self-assigned this Nov 15, 2017
@gitbrent gitbrent added this to the 1.10.0 milestone Nov 15, 2017
ericrockey pushed a commit to WeTransfer/PptxGenJS that referenced this issue Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants