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

Tables not being displayed after update #559

Closed
emartz404 opened this issue Jun 12, 2019 · 9 comments
Closed

Tables not being displayed after update #559

emartz404 opened this issue Jun 12, 2019 · 9 comments
Assignees
Milestone

Comments

@emartz404
Copy link

Hi, I've just updated from 1.10.0 to 2.5.0 and after adapting all listed breaking changes I've found that tables are completely gone from my ppt. I've tried using code from sample files, but still nothing :(

        let items = data,
            tableBlock = [],
            chunks = '',
            header = items.splice(0,1),
            toTable = [],
            baseTitle = title,
            iterations = 0;
        
            while(items.length > 0){
                if((iterations == 0) && items.length < 12){
                    title = baseTitle;
                }
                else{
                    title = baseTitle + ' - Part ' + (iterations + 1);   
                }
                toTable = items.splice(0,10);
                toTable.unshift(header[0]);
                let slide = new pptx.addNewSlide('COMPANY_PPT'),
                rows = []; 
                
            toTable.forEach(function(item, parentIndex){
                let row = [];
                item.forEach(function(elem, index){
                    let options = {};
                    if(index === 0 && parentIndex != 0){
                        options.color = '4ca3b5';
                        options.bold = true;
                        options.align = 'left';
                    }
                    if(parentIndex === 0){
                        options.bold = true;
                        options.fontSize = 10;
                    }
                    if(index != 0){
                        options.align = 'right';
                    } 
                    options.border = [{pt: 0, color: 'ffffff'},{pt: 0, color: 'ffffff'},{pt: 1, color: 'E3E3E1'}, {pt: 0, color: 'ffffff'}];
                    row.push({text: elem, options: options})
                });
                rows.push(row);
            });
            let options = {w: '60%', y: pptData.simpleLayout ? '21%' : '17%', x: pptData.simpleLayout ? '18%' : '35%', lineWeight: 5,  fontSize: 13, rowH: 0.5, valign: 'middle'};
            slide.addTable(rows, options);

The function gets executed - I'm able to pass any other sample code from the docs and it gets displayed: e.g: texts, images... - but anytime I try adding tables (sample or old working code), they won't display...

Is there any breaking change from v1 to v2 I'm missing? Thanks a lot!

@somprabhsharma
Copy link

Facing similar issue.

@emartz404
Copy link
Author

@somprabhsharma did you make it work?

@gitbrent
Copy link
Owner

Hi @emartz404

I dont know what the data in let items = data looks like, but tables definitely work in the most recent version using the sample code provided...

Online Demo

@emartz404
Copy link
Author

I've tried with the sample code and happens the same... Anyway, found that if I downgrade to v2.3.0 they work okay again

@emartz404
Copy link
Author

@gitbrent Found out it's a Keynote issue: if I open the demo file in google drive it's ok:
image
but in keynote:
image

@somprabhsharma
Copy link

somprabhsharma commented Aug 30, 2019

@emartz404 Hey, I could make it work. To make it work in keynote too, you need to set the background color to white. Use below code to create slide.
pptx.addNewSlide('slide name', {bkgd: 'ffffff', color: '000000'})

@gitbrent
Copy link
Owner

gitbrent commented Sep 3, 2019

@somprabhsharma is correct - the only issue with Keynote is the default background.

If you explicitly set one (e.g.: white) it'll appear as it does in PowerPoint.

This defect will be fixed in the upcoming 3.0 release.

@gitbrent gitbrent added this to the 3.0.0 milestone Sep 3, 2019
@emartz404
Copy link
Author

Thanks a lot @somprabhsharma @gitbrent !

@gitbrent
Copy link
Owner

gitbrent commented Sep 4, 2019

The issue of missing default [white] background in Keynote has been fixed in the 3.0 branch and will be released with 3.0.

Thanks @emartz404 @somprabhsharma

@gitbrent gitbrent closed this as completed Sep 4, 2019
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

3 participants