gitbrent / PptxGenJS

Create PowerPoint presentations with a powerful, concise JavaScript API.
https://gitbrent.github.io/PptxGenJS/
MIT License
2.94k stars 639 forks source link

BUG - Adding border option TOP border doesn't display for specified row #1318

Open whoami999 opened 8 months ago

whoami999 commented 8 months ago

We appreciate your feedback - to help the team understand your needs please complete the following template to ensure we have the details to help.

Submission Guidelines

Issue Category

Product Versions

Desired Behavior

let rows = [ [ { text:'Top Lft', options:{ valign:'t', align:'l', font_face:'Arial' } }, { text:'Top Ctr', options:{ valign:'t', align:'c', font_face:'Verdana' } }, { text:'Top Rgt', options:{ valign:'t', align:'r', font_face:'Courier' } } ], [ { text:'Middle Lft', options:{ valign:'t', align:'l', font_face:'Arial',
border: {type: 'solid', pt: 1.5, color: '#A98989'} } }, { text:'Middle Ctr', options:{ valign:'t', align:'c', font_face:'Verdana' } }, { text:'Middle Rgt', options:{ valign:'t', align:'r', font_face:'Courier' } } ] ]; let tabOpts = { x:0.5, y:3.5, w:9.0, rowH:0.6, fill:'F7F7F7', font_size:18, color:'6f9fc9', valign:'m'} slide.addTable( rows, tabOpts );

I would expect the 'Middle Lft' cell to have all borders as defined, solid, 1.5pt, and color #A98989

The intent of wanting to put a more defining border around an entire row. Also, table has a bunch of rows above and then have a aggregation of it and want a solid line Top border for the aggregation total row.

Observed Behavior

With having a non-top row cell defined with a border of type solid, pt 1.5, and color: A98989

All I get is a cell with Left, Right, and Bottom borders as defined.

Steps to Reproduce

If you go to: https://jsfiddle.net/gitbrent/L1uctxm0/ Paste in the below for the script file Javascript-pureJS

let pptx = new PptxGenJS(); $('small').before('(pptxgenjs version: ' + pptx.version + ')');

// Simple Slide window.doDemo = function do7cells() { let pptx = new PptxGenJS(); let slide = pptx.addSlide(); let opts = { x: 0.0, y: 0.25, w: '100%', h: 1.5, align: 'center', fontSize: 24, color: '0088CC', fill: 'F1F1F1' }; slide.addText( 'BONJOUR - CIAO - GUTEN TAG - HELLO - HOLA - NAMASTE - OLÀ - ZDRAS-TVUY-TE - こんにちは - 你好', opts );

let rows = [ [ { text:'Top Lft', options:{ align:'left', font_face:'Arial' } }, { text:'Top Ctr', options:{ align:'center', font_face:'Verdana' } }, { text:'Top Rgt', options:{ align:'right', font_face:'Courier' } } ], [ { text:'Middle Lft', options:{ valign:'top', align:'left', font_face:'Arial',
border: {type: 'solid', pt: 1.5, color: '#A98989'} } }, { text:'Middle Ctr', options:{ valign:'middle', align:'center', font_face:'Verdana' } }, { text:'Middle Rgt', options:{ valign:'bottom', align:'right', font_face:'Courier' } } ] ]; let tabOpts = { x:0.5, y:3.5, w:9.0, rowH:0.6, fill:'F7F7F7', font_size:18, color:'6f9fc9', valign:'m'} slide.addTable( rows, tabOpts );

pptx.writeFile(); }

whoami999 commented 8 months ago
let rows = [
[
{ text:'Top Lft', options:{ align:'left', font_face:'Arial'} },
{ text:'Top Ctr', options:{ align:'center', font_face:'Verdana' } },
{ text:'Top Rgt', options:{ align:'right', font_face:'Courier' } }
],
[
{ text:'Middle Lft', options:{ valign:'top', align:'left', font_face:'Arial' } },
{ text:'Middle Ctr', options:{ valign:'middle', align:'center', font_face:'Verdana',
border: [
{type: 'solid', pt: 1.5, color: '#A98989'},
{type: 'solid', pt: 2.5, color: '#A98989'},
{type: 'solid', pt: 3.5, color: '#A98989'},
{type: 'solid', pt: 3.5, color: '#A98989'}]
} },
{ text:'Middle Rgt', options:{ valign:'bottom', align:'right', font_face:'Courier' } }
]
];

Utilizing that for the rows, we notice that non first column Left borders are not styled. So, Right and Bottom styles are being applied but not the left and top border styles unless it is the first column or first row.