diff --git a/examples/word/make_docx.js b/examples/word/make_docx.js index 3566479f..b97a1ad5 100644 --- a/examples/word/make_docx.js +++ b/examples/word/make_docx.js @@ -69,6 +69,23 @@ pObj.addText('Those two lines are in the same paragraph,') pObj.addLineBreak() pObj.addText('but they are separated by a line break.') +pObj = docx.createP({border:{ + bottom:{ + color: '000088', + val: 'dashed', + space: "8", + sz : '4' + } + },}) +pObj.addText('This is a paragraph with a bottom border, and the blue dotted lines are spaced 8. You can also extend the border in other directions.') +pObj = docx.createP({border:{ + left:{}, + right:{}, + top:{}, + bottom:{} + },}) +pObj.addText('This is a paragraph with a border around it,top right bottom left') + docx.putPageBreak() pObj = docx.createP() diff --git a/lib/docx/gendocx.js b/lib/docx/gendocx.js index 0132de17..d27f5887 100644 --- a/lib/docx/gendocx.js +++ b/lib/docx/gendocx.js @@ -348,7 +348,26 @@ function makeDocx(genobj, new_type, options, gen_private, type_info) { objs_list[i].options.backline + '" w:fill="auto"/>' } // Endif. - + if (objs_list[i].options.border) { + pPrData +='' + var directions = ['top','bottom','left','right'] + var szDef = 4 + var spaceDef = 8 + var valDef = 'single' + var colorDef = '000000' + for (var direction of directions) { + if(objs_list[i].options.border[direction]){ + var borderSetting = objs_list[i].options.border[direction] + var val = borderSetting.val ||valDef + var sz = borderSetting.sz ||szDef + var space = borderSetting.space ||spaceDef + var color = borderSetting.color ||colorDef + pPrData += '' + } + } + pPrData += '' + } if (objs_list[i].options.spacing) { var pSpacing = objs_list[i].options.spacing if (typeof pSpacing === 'object') {