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

Table-to-Slides default for un-styled tables is black text on black bkgd #57

Closed
orpitadutta opened this issue Mar 15, 2017 · 9 comments
Closed
Assignees

Comments

@orpitadutta
Copy link

I implemented table to slides but each time a black band appears. Can you please help? Or assist me where am i going wrong?

Presentation (1).pptx

Name Test Company
@gitbrent
Copy link
Owner

Hi @orpitadutta ,

Could you please attach a screencap instead and provide the code you're using?

Thanks.

@gitbrent gitbrent self-assigned this Mar 16, 2017
@orpitadutta
Copy link
Author

image

<title>DEMO</title> <script src="nextgen/jquery.min.js"></script> <script src="nextgen/jszip.min.js"></script> <script src="nextgen/filesaver.min.js"></script> <script src="nextgen/pptxgen.js"></script> <script src="nextgen/pptxgen.shapes.js"></script>
<table id="mytable">
    <thead>
        <tr>
            <th>Name</th>
            <th>Test</th>
            <th>Company</th>
        </tr>
    </thead>
</table>
<input type="button" value="Export to PPTX"
       onclick="{ var pptx = new PptxGenJS(); pptx.addSlidesForTable('mytable'); pptx.save(); }">

@alagarrk
Copy link

Hi @orpitadutta ,

I think, you need to apply some styles for the table. Currently table - background color is black & also text color is black. So you are seeing black box. @gitbrent Please correct me if i am wrong.

Ex:

Name Test Company
@orpitadutta Please try it

@orpitadutta
Copy link
Author

orpitadutta commented Mar 17, 2017

@alagarrk Thanks a lot, It worked but i am unable to change the background of table. Can u please help?

@orpitadutta
Copy link
Author

I tried this:

<script type="text/javascript"> function fnppt() { var tabOpts = { x:0.5, y:2.0, w:9.0, fill:'F7F7F7', font_size:18, color:'6f9fc9' }; var pptx = new PptxGenJS(); pptx.addSlidesForTable('mytable',tabOpts ); pptx.save(); } </script>
Name Test Company
<input type="button" value="Export to PPTX" onclick="fnppt()">

@alagarrk
Copy link

@orpitadutta , For addSlidesForTable() - Reproduces an HTML table - background colors, borders, fonts, padding, etc.

So you can add styles using css. For Ex:
#mytable {
background: #f2f2f2;
border: 1px solid black;
color: black;
}

#mytable th,
#mytable tr {
    background: #f2f2f2;
}

Please check this

@orpitadutta
Copy link
Author

@alagarrk Thnxx a lot it worked like a charm..

@gitbrent gitbrent changed the title Table-to-Slides HTML Options Table-to-Slides default for un-styled tables is black text on black bkgd Mar 20, 2017
gitbrent pushed a commit that referenced this issue Mar 21, 2017
@gitbrent
Copy link
Owner

Hi @orpitadutta @alagarrk ,

Thanks for your help on this Issue.

Turns out that the default color returned by jQuery is black, so in un-styled tables, you end up with black text on a black background...

I've updated the code to detect this condition and default to a white background instead.

@Strawberry0215
Copy link

hi @gitbrent is it possible for addTable to call it on it's ID instead of var array?

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

4 participants