Header Column A | Header Column B |
---|---|
Value Cell A2 | Value Cell B2 |
Value Cell A3 | Value Cell B3 |
Cell1 |
Cell1 | Cell2 |
Cell1 |
Cell2 |
Col A | Col B | Col C | Col D |
---|---|---|---|
Cell A1 | Cell B1 & B2 | Cell C1 | Cell D1 & D2 |
Cell A2 | Cell C2 | ||
Cell A3 | Cell B3 & C3 | Cell D3 | |
Cell A4 & A5 & B4 & B5 & C4 & C5 | Cell D4 | ||
Cell D5 |
Col A | Col B | Col C | Col D |
---|---|---|---|
Cell A1 | Cell B1 & B2 | Cell C1 | Cell D1 & D2 |
Cell A2 | Cell C2 | ||
Cell A3 | Cell B3 & C3 | Cell D3 | |
Cell A4 & A5 & B4 & B5 & C4 & C5 | Cell D4 | ||
Cell D5 |
header | |
---|---|
Cell A1 | Cell A2 |
Cell B1 |
test
', {window:window}); if (debug) console.log(JSON.stringify(ret)); t.check(Array.isArray(ret) && ret.length===1, "return is OK"); ret = ret[0].text[0].text[0].text[0]; t.check( ret.text === "test" && ret.bold && ret.italics && ret.fontSize === 11 && ret.alignment === 'center' && Array.isArray(ret.style) && ret.style.includes('html-strong') && ret.style.includes('html-em') && ret.style.includes('html-span') && ret.style.includes('html-p'), "cascade_tags"); t.finish(); }) test("hr", function(t) { var ret = htmlToPdfMake("Header Column B |
|
---|---|
Value Cell A2 | Value Cell B2 |
Value Cell A3 | Value Cell B3 |
Header Column B |
|
---|---|
Value Cell A2 | Value Cell B2 |
Value Cell A3 | Value Cell B3 |
Cell with border left and right in blue |
some text p1span1span2 p2 span3p3span4 span5 strongp4 |
Test
Test
`; var ret = htmlToPdfMake(html, {window:window}); if (debug) console.log(JSON.stringify(ret)); t.check(Array.isArray(ret) && ret.length===1, "return is OK"); t.check(Array.isArray(ret[0].text) && ret[0].text.length===1 && Array.isArray(ret[0].text[0].text) && ret[0].text[0].text.length===1, "structure is OK"); ret = ret[0].text[0].text[0]; t.check(ret.text === "Test", "text is 'Test'"); t.check(ret.nodeName === "SPAN", "nodeName is 'SPAN'"); t.check(Array.isArray(ret.decoration), "'decoration' is array"); t.check(ret.decoration.includes("underline"), "includes 'underline'"); t.check(ret.decoration.includes("lineThrough"), "includes 'lineThrough'"); t.finish(); }) test("font", function (t) { var html = `font element`; var ret = htmlToPdfMake(html, {window: window}); if (debug) console.log(JSON.stringify(ret)); t.check(Array.isArray(ret) && ret.length === 1, "return is OK"); ret = ret[0]; t.check(ret.color === "#ff0033" && ret.fontSize === 18, ""); t.finish(); }); test("sup", function (t) { var html = `sup`; var ret = htmlToPdfMake(html, {window: window}); if (debug) console.log(JSON.stringify(ret)); t.check(Array.isArray(ret) && ret.length === 1, "return is OK"); ret = ret[0]; t.check(ret.text === "sup" && ret.sup && ret.sup.offset && ret.sup.fontSize, ""); t.finish(); }); test("sub", function (t) { var html = `sub`; var ret = htmlToPdfMake(html, {window: window}); if (debug) console.log(JSON.stringify(ret)); t.check(Array.isArray(ret) && ret.length === 1, "return is OK"); ret = ret[0]; t.check(ret.text === "sub" && ret.sub && ret.sub.offset && ret.sub.fontSize, ""); t.finish(); });