using NetCorePpt; namespace NetCorePptxTest.Modules; using static Constants; public class DemoTable { /// /// SLIDE 1= Table text alignment and cell styles /// /// public static void genSlide01(PptxGen pptx, int segment = 100) { Slide slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables" }); { slide.addTable(new List { new TableRow { new TableCell { text = "Table Examples 1", options = BASE_TEXT_OPTS_L }, BASE_TEXT_OPTS_R } }, BASE_TABLE_OPTS); slide.addNotes("API Docs:\nhttps://gitbrent.github.io/PptxGenJS/docs/api-tables.html"); } { // DEMO= align/valign var objOpts1 = new TextPropsOptions { x = 0.5, y = 0.7, w = 4, h = 0.3, margin = 0, fontSize = 18, fontFace = "Arial", color = "0088CC" }; slide.addText("Cell Text Alignment:", objOpts1); var arrTabRows1 = new List { new TableRow { new TableCell { text= "Top Lft", options = new TableCellProps { valign= VAlign.top, align= HAlign.left, fontFace= "Arial" } }, new TableCell { text= "Top Ctr", options = new TableCellProps { valign= VAlign.top, align= HAlign.center, fontFace= "Courier" } }, new TableCell { text= "Top Rgt", options = new TableCellProps { valign= VAlign.top, align= HAlign.right, fontFace= "Verdana" } }, }, new TableRow { new TableCell { text= "Mdl Lft", options = new TableCellProps{ valign= VAlign.middle, align= HAlign.left } }, new TableCell { text= "Mdl Ctr", options = new TableCellProps{ valign= VAlign.middle, align= HAlign.center } }, new TableCell { text= "Mdl Rgt", options = new TableCellProps{ valign= VAlign.middle, align= HAlign.right } }, }, new TableRow { new TableCell{ text= "Btm Lft", options = new TableCellProps{ valign= VAlign.bottom, align= HAlign.left } }, new TableCell{ text= "Btm Ctr", options = new TableCellProps{ valign= VAlign.bottom, align= HAlign.center } }, new TableCell{ text= "Btm Rgt", options = new TableCellProps{ valign= VAlign.bottom, align= HAlign.right } }, } }; slide.addTable(arrTabRows1, new TableProps { x = 0.5, y = 1.1, w = 5.0, rowH = 0.75, fill = ("F7F7F7"), fontSize = 14, color = "363636", border = new BorderProps ("BBCCDD", null, 1), }); } // Pass default cell style as tabOpts, then just style/override individual cells as needed { // DEMO= cell styles var objOpts2 = new TextPropsOptions { x = 6.0, y = 0.7, w = 4, h = 0.3, margin = 0, fontSize = 18, fontFace = "Arial", color = "0088CC" }; slide.addText("Cell Styles:", objOpts2); var arrTabRows2 = new List { new TableRow { new TableCell { text= "white", options=new TableCellProps { fill= ("6699CC"), color= "FFFFFF" } }, new TableCell { text= "yellow", options=new TableCellProps { fill= ("99AACC"), color= "FFFFAA" } }, new TableCell { text= "hyperlink", options= new TableCellProps{ fill= ("AACCFF"), hyperlink = 2 } }, }, new TableRow { new TableCell { text= "12pt", options= new TableCellProps{ fill= ("FF0000"), fontSize= 12 } }, new TableCell { text= "20pt", options=new TableCellProps { fill= "00FF00", fontSize= 20 } }, new TableCell { text= "28pt", options=new TableCellProps { fill= "0000FF", fontSize= 28 } }, }, new TableRow { new TableCell{ text= "Bold", options= new TableCellProps{ fill= "003366", bold= true } }, new TableCell{ text= "Underline", options= new TableCellProps{ fill= "336699", underline= TextUnderlineStyle.sng } }, new TableCell{ text= "0.15 margin", options=new TableCellProps { fill= "6699CC", margin= 0.15 } }, }, }; slide.addTable(arrTabRows2, new TableProps { x = 6.0, y = 1.1, w = 7.0, rowH = 0.75, fill = "F7F7F7", color = "FFFFFF", fontSize = 16, valign = VAlign.middle, align = HAlign.center, border = new BorderProps ("FFFFFF", null, 5), }); } { // DEMO= Row/Col Width/Heights var objOpts3 = new TextPropsOptions { x = 0.5, y = 3.6, h = 0.3, margin = 0, fontSize = 18, fontFace = "Arial", color = "0088CC" }; slide.addText("Row/Col Heights/Widths:", objOpts3); var arrTabRows3 = new List { new TableRow { new TableCell { text= "1x1" }, new TableCell { text= "2x1" }, new TableCell { text= "2.5x1" }, new TableCell { text= "3x1" }, new TableCell { text= "4x1" } }, new TableRow { new TableCell { text= "1x2" }, new TableCell { text= "2x2" }, new TableCell { text= "2.5x2" },new TableCell { text= "3x2" }, new TableCell { text= "4x2" } } }; slide.addTable(arrTabRows3, new TableProps { x = 0.5, y = 4.0, rowH = new List { 1, 2 }, //{1, 2}, colW = new List { 1, 2, 2.5, 3, 4 }, fill = "F7F7F7", color = "6c6c6c", fontSize = 14, valign = VAlign.middle, align = HAlign.center, border = new BorderProps ("BBCCDD", null, 2), }); } } /// /// SLIDE 2= Table row/col-spans /// /// public static void genSlide02(PptxGen pptx) { Slide slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables" }); { slide.addTable(new List { new TableRow { new TableCell { text = "Table Examples 2", options = BASE_TEXT_OPTS_L }, BASE_TEXT_OPTS_R } }, new TableProps { x = "4%", y = "2%", w = "95%", h = "4%" }); // QA= this table's x,y,w,h all using % slide.addNotes("API Docs: https://gitbrent.github.io/PptxGenJS/docs/api-tables.html"); } { // DEMO= Rowspans/Colspans var optsSub = CloneTextOption(BASE_OPTS_SUBTITLE); slide.addText("Colspans/Rowspans:", optsSub); var tabOpts1 = new TableProps { x = 0.67, y = 1.1, w = "90%", h = 2, fill = "F9F9F9", color = "3D3D3D", fontSize = 16, border = new BorderProps("FFFFFF", null, 4), align = HAlign.center, valign = VAlign.middle, }; var arrTabRows1 = new List { new TableRow { new TableCell { text= "A1\nA2", options= new TableCellProps { rowspan= 2, fill= "99FFCC" } }, new TableCell { text= "B1" }, new TableCell { text= "C1 -> D1", options= new TableCellProps { colspan= 2, fill= "99FFCC" } }, new TableCell { text= "E1" }, new TableCell { text= "F1\nF2\nF3", options= new TableCellProps{ rowspan= 3, fill= "99FFCC" } }, }, new TableRow { "B2", "C2", "D2", "E2" }, new TableRow { "A3", "B3", "C3", "D3", "E3"}, }; // NOTE= Follow HTML conventions for colspan/rowspan cells - cells spanned are left out of arrays - see above // The table above has 6 columns, but each of the 3 rows has 4-5 elements as colspan/rowspan replacing the missing ones // (e.g.= there are 5 elements in the first row, and 6 in the second) slide.addTable(arrTabRows1, tabOpts1); } { var tabOpts2 = new TableProps { x = 0.5, y = 3.3, w = 12.4, h = 1.5, fontSize = 14, fontFace = "Courier", align = HAlign.center, valign = VAlign.middle, fill = "F9F9F9", border = new BorderProps("c7c7c7", null, 1), }; var arrTabRows2 = new List { new TableRow{ new TableCell { text= "A1\n--\nA2", options= new TableCellProps { rowspan= 2, fill= ("99FFCC") } }, new TableCell { text= "B1\n--\nB2", options= new TableCellProps { rowspan= 2, fill= ("99FFCC") } }, new TableCell { text= "C1 -> D1", options= new TableCellProps { colspan= 2, fill= ("9999FF") } }, new TableCell { text= "E1 -> F1", options= new TableCellProps { colspan= 2, fill= ("9999FF") } }, "G1", }, new TableRow{ "C2", "D2", "E2", "F2", "G2"}, }; slide.addTable(arrTabRows2, tabOpts2); } { // BTM-LEFT var tabOpts3 = new TableProps { x = 0.5, y = 5.15, w = 6.0, h = 2, margin = 0.05, align = HAlign.center, valign = VAlign.middle, fontSize = 16, border = new BorderProps(pptx.color.TEXT2, null, 2), fill = ("F1F1F1"), }; var arrTabRows3 = new List { new TableRow{ new TableCell { text= "A1\nA2\nA3", options= new TableCellProps{ rowspan= 3, fill= (SCHEME_COLORS.accent6) } }, new TableCell { text= "B1\nB2", options= new TableCellProps{ rowspan= 2, fill= (SCHEME_COLORS.accent2) } }, new TableCell { text= "C1", options= new TableCellProps{ fill= (SCHEME_COLORS.accent4) } }, }, new TableRow{ new TableCell { text= "C2", options= new TableCellProps { fill= (SCHEME_COLORS.accent4) } } }, new TableRow{ new TableCell { text= "B3 -> C3", options= new TableCellProps { colspan= 2, fill= (SCHEME_COLORS.accent5) } } }, }; slide.addTable(arrTabRows3, tabOpts3); } { // BTM-RIGHT var tabOpts4 = new TableProps { x = 6.93, y = 5.15, w = 6.0, h = 2, margin = 0, align = HAlign.center, valign = VAlign.middle, fontSize = 16, border = new BorderProps(pptx.color.TEXT2, null, 1), fill = "f2f9fc", }; var arrTabRows4 = new List{ new TableRow { new TableCell { text= "A1", options= new TableCellProps { fill= new ShapeFillProps(SCHEME_COLORS.accent4, 25, null) } }, new TableCell { text= "B1\nB2", options=new TableCellProps { rowspan= 2, fill= new ShapeFillProps(SCHEME_COLORS.accent2, 25) } }, new TableCell { text= "C1\nC2\nC3", options= new TableCellProps{ rowspan= 3, fill= new ShapeFillProps(SCHEME_COLORS.accent6, 25 ) } }, }, new TableRow{ new TableCell { text= "A2", options= new TableCellProps { fill= new ShapeFillProps (SCHEME_COLORS.accent4, 25) } }}, new TableRow{ new TableCell { text= "A3 -> B3", options= new TableCellProps { colspan= 2, fill= new ShapeFillProps (SCHEME_COLORS.accent5, 25) } }}, }; slide.addTable(arrTabRows4, tabOpts4); } } /// /// SLIDE 3= Super rowspan/colspan demo /// /// public static void genSlide03(PptxGen pptx) { Slide slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables" }); slide.addTable(new List { new TableRow { new TableCell { text = "Table Examples 3", options = BASE_TEXT_OPTS_L }, BASE_TEXT_OPTS_R } }, BASE_TABLE_OPTS); slide.addNotes("API Docs: https://gitbrent.github.io/PptxGenJS/docs/api-tables.html"); // DEMO= Rowspans/Colspans ---------------------------------------------------------------- var optsSub = CloneTextOption(BASE_OPTS_SUBTITLE); slide.addText("Extreme Colspans/Rowspans:", optsSub); var optsRowspan2 = new TableCellProps { rowspan = 2, fill = "99FFCC" }; var optsRowspan3 = new TableCellProps { rowspan = 3, fill = "99FFCC" }; var optsRowspan4 = new TableCellProps { rowspan = 4, fill = "99FFCC" }; var optsRowspan5 = new TableCellProps { rowspan = 5, fill = "99FFCC" }; var optsColspan2 = new TableCellProps { colspan = 2, fill = "9999FF" }; var optsColspan3 = new TableCellProps { colspan = 3, fill = "9999FF" }; var optsColspan4 = new TableCellProps { colspan = 4, fill = "9999FF" }; var optsColspan5 = new TableCellProps { colspan = 5, fill = "9999FF" }; var arrTabRows5 = new List{ new TableRow { "A1", "B1", "C1", "D1", "E1", "F1", "G1", "H1", new TableCell { text= "I1\n-\nI2\n-\nI3\n-\nI4\n-\nI5", options= optsRowspan5 }, new TableCell { text= "J1 -> K1 -> L1 -> M1 -> N1", options= optsColspan5 }, }, new TableRow { new TableCell{ text= "A2\n--\nA3", options= optsRowspan2 }, new TableCell{ text= "B2 -> C2 -> D2", options= optsColspan3 }, new TableCell{ text= "E2 -> F2", options= optsColspan2 }, new TableCell{ text= "G2\n-\nG3\n-\nG4", options= optsRowspan3 }, "H2", "J2", "K2", "L2", "M2", "N2", }, new TableRow { new TableCell{ text= "B3\n-\nB4\n-\nB5", options= optsRowspan3 }, "C3", "D3", "E3", "F3", "H3", "J3", "K3", "L3", "M3", "N3" }, new TableRow { new TableCell{ text= "A4\n--\nA5", options= optsRowspan2 }, new TableCell{ text= "C4 -> D4 -> E4 -> F4", options= optsColspan4 }, "H4", new TableCell{ text= "J4 -> K4 -> L4", options= optsColspan3 }, new TableCell{ text= "M4\n--\nM5", options= optsRowspan2 }, new TableCell{ text= "N4\n--\nN5", options= optsRowspan2 }, }, new TableRow { "C5", "D5", "E5", "F5", new TableCell{ text= "G5 -> H5", options= new TableCellProps { colspan= 2, fill= "9999FF" } }, "J5", "K5", "L5" }, }; var taboptions5 = new TableProps { x = 0.6, y = 1.3, w = "90%", h = 5.5, margin = 0, fontSize = 14, align = HAlign.center, valign = VAlign.middle, border = new BorderProps(null, null, 1) }; slide.addTable(arrTabRows5, taboptions5); } /// /// SLIDE 4= Cell Formatting / Cell Margins /// /// public static void genSlide04(PptxGen pptx) { Slide slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables" }); { slide.addTable(new List { new TableRow { new TableCell { text = "Table Examples 4", options = BASE_TEXT_OPTS_L }, BASE_TEXT_OPTS_R } }, BASE_TABLE_OPTS); slide.addNotes("API Docs: https://gitbrent.github.io/PptxGenJS/docs/api-tables.html"); } { // Cell Margins var optsSub = CloneTextOption(BASE_OPTS_SUBTITLE); slide.addText("Cell Margins:", optsSub); } { slide.addTable(new List { new TableRow { "margin:0" } }, new TableProps { x = 0.5, y = 1.1, margin = 0, w = 1.2, fill = "FFFCCC", border = new BorderProps (null, null, 0) }); slide.addTable(new List { new TableRow { "margin:[0, 0, 0, 0.3]" } }, new TableProps { x = 2.5, y = 1.1, margin = (0, 0, 0, 0.3), w = 2.0, fill = "FFFCCC", align = HAlign.right }); } { slide.addTable(new List { new TableRow { "margin:0.05" } }, new TableProps { x = 5.5, y = 1.1, margin = 0.05, w = 1.0, fill = (SCHEME_COLORS.bg2) }); slide.addTable(new List { new TableRow { "margin:[0.6, 0.05, 0.05, 0.3]" } }, new TableProps { x = 7.1, y = 1.1, margin = (0.6, 0.05, 0.05, 0.3), w = 2.6, fill = "F1F1F1" }); slide.addTable(new List { new TableRow { "margin:[0.45, 0.05, 0.05, 0.45]" } }, new TableProps { x = 10.1, y = 1.1, margin = (0.45, 0.05, 0.05, 0.45), w = 2.6, fill = "F1F1F1" }); } { slide.addTable(new List{ new TableRow { new TableCell { text= "no border and number zero", options= new TableCellProps { margin= 0.05 } }, new TableCell { text= 0, options= new TableCellProps{ margin= 0.05 } }, }, }, new TableProps { x = 0.5, y = 1.9, fill = "f2f9fc", border = BorderType.none, colW = new List { 2.5, 0.5 } } ); slide.addTable(new List { new TableRow { new TableCell { text = "text-obj margin:0", options = new TableCellProps { margin = 0 } } } }, new TableProps { x = 4.0, y = 1.9, w = 2, fill = "f2f9fc" }); } { // Test margin option when using both plain and text object cells var arrTextObjects = new List { new TableRow{"Plain text", "Cell 2", "3"}, new TableRow { new TableCell{ text= "text Objects", options= new TableCellProps { color= "99ABCC", align= HAlign.right } }, new TableCell{ text= "2nd cell", options= new TableCellProps{ color= "0000EE", align= HAlign.center } }, new TableCell{ text= "hyperlink", options= new TableCellProps{ hyperlink= ("https://github.com/gitbrent/pptxgenjs") } }, } }; slide.addTable(arrTextObjects, new TableProps { x = 0.5, y = 2.7, w = 12.25, margin = 8, fill = "F1F1F1", border = new BorderProps ("696969", null, 1) }); // DEPRECATED= `margin` in points } // Complex/Compound border { var optsSub = CloneTextOption(BASE_OPTS_SUBTITLE); optsSub.y = 3.9; slide.addText("Complex Cell Borders:", optsSub); Border arrBorder1 =( new BorderProps("FF0000", null, 1), new BorderProps("00ff00", null, 3), new BorderProps("0000ff", null, 5), new BorderProps("9e9e9e", null, 7) )!; slide.addTable(new List { new TableRow { "Borders 4!" } }, new TableProps { x = 0.5, y = 4.3, w = 6, rowH = 1.5, fill = (SCHEME_COLORS.bg2), color = "3D3D3D", fontSize = 18, border = arrBorder1, align = HAlign.center, valign = VAlign.middle, }); } { (BorderProps?, BorderProps?, BorderProps?, BorderProps?) arrBorder2 = ( new BorderProps("ff0000", BorderType.dash,2), null, new BorderProps("0000ff", BorderType.dash, 5), null ); slide.addTable(new List { new TableRow { "Borders 2!" } }, new TableProps { x = 6.75, y = 4.3, w = 6, rowH = 1.5, fill = (SCHEME_COLORS.bg2), color = "3D3D3D", fontSize = 18, border = arrBorder2, align = HAlign.center, valign = VAlign.middle, }); } // Special char check { var optsSub = CloneTextOption(BASE_OPTS_SUBTITLE); optsSub.y = 6.1; slide.addText("Escaped Special Chars:", optsSub); var arrTabRows3 = new List { new TableRow { "<", ">", "\"", "'", "&", "plain" } }; slide.addTable(arrTabRows3, new TableProps { x = 0.5, y = 6.5, w = 12.3, rowH = 0.5, fill = "F9F9F9", color = "3D3D3D", border = new BorderProps("FFFFFF", null, 1), align = HAlign.center, valign = VAlign.middle, }); } } /// /// SLIDE 5= Cell Word-Level Formatting /// /// public static void genSlide05(PptxGen pptx) { Slide slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables" }); { slide.addTable(new List { new TableRow { new TableCell { text = "Table Examples 5", options = BASE_TEXT_OPTS_L }, BASE_TEXT_OPTS_R } }, BASE_TABLE_OPTS); slide.addNotes("API Docs: https://gitbrent.github.io/PptxGenJS/docs/api-tables.html"); } { slide.addText( "The following textbox and table cell use the same array of text/options objects, making word-level formatting familiar and consistent across the library.", new TextPropsOptions { x = 0.5, y = 0.5, w = "95%", h = 0.5, margin = 0.1, fontSize = 14 } ); slide.addText( "[\n" + " { text:'1st line', options:{ fontSize:24, color:'99ABCC', align:'right', breakLine:true } },\n" + " { text:'2nd line', options:{ fontSize:36, color:'FFFF00', align:'center', breakLine:true } },\n" + " { text:'3rd line', options:{ fontSize:48, color:'0088CC', align:'left' } }\n" + "]", new TextPropsOptions { x = 1, y = 1.1, w = 11, h = 1.25, margin = 0.1, fontFace = "Courier", fontSize = 13, fill = "F1F1F1", color = "333333" } ); // Textbox= text word-level formatting slide.addText("Textbox:", new TextPropsOptions { x = 1, y = 2.8, w = 3, h = 2, fontSize = 18, fontFace = "Arial", color = "0088CC" }); } var arrTextObjects = new List { new TextProps { text= "1st line", options= new TextPropsOptions { fontSize= 24, color= "99ABCC", align= HAlign.right, breakLine= true } }, new TextProps { text= "2nd line", options= new TextPropsOptions { fontSize= 36, color= "FFFF00", align= HAlign.center, breakLine= true } }, new TextProps { text= "3rd line", options= new TextPropsOptions { fontSize= 48, color= "0088CC", align= HAlign.left } }, }; { slide.addText(arrTextObjects, new TextPropsOptions { x = 2.5, y = 2.8, w = 9.5, h = 2, margin = 0.1, fill = "232323" }); } { // Table cell= Use the exact same code from addText to do the same word-level formatting within a cell slide.addText("Table:", new TextPropsOptions { x = 1, y = 5, w = 3, h = 2, fontSize = 18, fontFace = "Arial", color = "0088CC" }); } { var opts2 = new TableProps { x = 2.5, y = 5, h = 2, align = HAlign.center, valign = VAlign.middle, colW = new List { 1.5, 1.5, 6.5 }, border = new BorderProps (null, null, 1), fill = "F1F1F1" }; var arrTabRows = new List{ new TableRow { new TableCell { text= "Cell 1A", options= new TableCellProps{ fontFace= "Arial" } }, new TableCell { text= "Cell 1B", options= new TableCellProps{ fontFace= "Courier" } }, new TableCell { text= arrTextObjects.ConvertAll(x=> new TableCell { text = x.text!, options = new TableCellProps { fontSize= x.options?.fontSize, color= x.options?.color, align= x.options?.align, breakLine= x.options?.breakLine } }) , options= new TableCellProps{ fill= "232323" } }, }, }; slide.addTable(arrTabRows, opts2); } } /// /// SLIDE 6= Cell Word-Level Formatting /// /// public static void genSlide06(PptxGen pptx) { Slide slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables" }); slide.addTable(new List { new TableRow { new TableCell { text = "Table Examples 6", options = BASE_TEXT_OPTS_L }, BASE_TEXT_OPTS_R } }, BASE_TABLE_OPTS); slide.addNotes("API Docs: https://gitbrent.github.io/PptxGenJS/docs/api-tables.html"); var optsSub = CloneTextOption(BASE_OPTS_SUBTITLE); slide.addText("Table Cell Word-Level Formatting:", optsSub); // EX 1= var arrCell1 = new TableRow { new TableCell { text = "Cell\n#1", options = new TableCellProps { color = "0088cc" } } }; var arrCell2 = new TableRow { new TableCell{ text= "Red ", options= new TableCellProps{ color= "FF0000" } }, new TableCell{ text= "Green ", options= new TableCellProps{ color= "00FF00" } }, new TableCell{ text= "Blue", options=new TableCellProps { color= "0000FF" } }, }; var arrCell3 = new TableRow { new TableCell { text = "google", options = new TableCellProps { bullet = true, color = SCHEME_COLORS.accent1, hyperlink = ("https://www.google.com") } } }; var arrCell4 = new TableRow { new TableCell { text = "Numbers\nNumbers\nNumbers", options = new TableCellProps { color = "0088cc", bullet = new CustomTextBullet { type = BulletType.number } } } }; slide.addTable(new List { new TableRow { new TableCell { text= arrCell1 }, new TableCell { text= arrCell2, options = new TableCellProps { valign= VAlign.middle } }, new TableCell { text= arrCell3, options = new TableCellProps { valign= VAlign.middle } }, new TableCell { text= arrCell4, options = new TableCellProps { valign= VAlign.bottom } }, }, }, new TableProps { x = 0.6, y = 1.25, w = 12, h = 3, fontSize = 24, border = new BorderProps (null, null, 1), fill = "F1F1F1" } ); // EX 2= slide.addTable(new List{ new TableRow { new TableCell { text=new TableRow { new TableCell { text= "I am a text object with bullets ", options = new TableCellProps { color= "CC0000", bullet= new CustomTextBullet { characterCode= "2605" } } }, new TableCell { text= "and i am the next text object", options = new TableCellProps { color= "00CD00", bullet= new CustomTextBullet { characterCode= "25BA" } } }, new TableCell { text= "Final text object w/ bullet:true", options = new TableCellProps { color= "0000AB", bullet= true } }, }, }, new TableCell { text=new TableRow { new TableCell { text= "Cell", options= new TableCellProps { fontSize= 36, align= HAlign.left, color= "8648cd" } }, new TableCell { text= "#2", options= new TableCellProps { fontSize= 60, align= HAlign.right, color= "CD0101" } }, }, }, new TableCell { text=new TableRow { new TableCell { text= "Cell", options = new TableCellProps { fontSize= 36, fontFace= "Courier", color= "dd0000", breakLine= true } }, new TableCell { text= "#", options = new TableCellProps { fontSize= 60, color= "8648cd" } }, new TableCell { text= "3", options = new TableCellProps { fontSize= 60, fontFace= "Times", color= "33ccef" } }, }, }, }, }, new TableProps { x = 0.6, y = 4.75, h = 2, fontSize = 24, colW = new List { 8, 2, 2 }, valign = VAlign.middle, border = new BorderProps(null, null, 1), fill = "F1F1F1" }); } /// /// SLIDE 7{...}= Table auto-paging /// /// public static void genSlide07(PptxGen pptx) { Slide slide = null!; // STEP 1= Build data var arrRows = new List { }; var arrText = new List { }; var arrRowsHead1 = new List { }; var arrRowsHead2 = new List{ new TableRow { new TableCell { text= "Title Header", options = new TableCellProps { fill= "0088cc", color= "ffffff", align= HAlign.center, bold= true, colspan= 3, // colW= 4 } } } }; if (1 == 1) { arrRows.Add(new TableRow{ new TableCell { text= "ID#", options = new TableCellProps { fill= "0088cc", color= "ffffff", valign= VAlign.middle } }, new TableCell { text= "First Name", options = new TableCellProps { fill= "0088cc", color= "ffffff", valign= VAlign.middle } }, new TableCell { text= "Lorum Ipsum", options = new TableCellProps { fill= "0088cc", color= "ffffff", valign= VAlign.middle } }, }); var idx = 0; TABLE_NAMES_F.ForEach((name) => { var strText = idx == 0 ? LOREM_IPSUM.JsSubstring(0, 100) : LOREM_IPSUM.JsSubstring(idx * 100, idx * 200); arrRows.Add(new TableRow { (idx + 1), name, strText }); arrText.Add(new TableRow { strText }); idx++; }); idx = 0; arrRows.ForEach((row) => { if (idx < 6) arrRowsHead1.Add(row); idx++; }); idx = 0; arrRows.ForEach((row) => { if (idx < 6) arrRowsHead2.Add(row); idx++; }); } // EX-1= "Basic Auto-Paging Example" { slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables= Auto-Paging" }); slide.addNotes("API Docs: https://gitbrent.github.io/PptxGenJS/docs/api-tables.html"); slide.addText(new List{ new TextProps { text= "Table Examples: ", options= DEMO_TITLE_TEXT }, new TextProps { text= "Basic Auto-Paging Example", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 0.5, y = 0.13, w = "90%" }); // var n = arrRows.SelectMany(x => x).Where(x => x.text?.isArray==true).ToList(); slide.addTable(arrRows, new TableProps { x = 0.5, y = 0.5, colW = new List { 0.75, 1.75, 10 }, margin = 0.05, border = new BorderProps ("CFCFCF"), autoPage = true }); } // EX-2= "Paging with smaller table area (50% width)" { slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: Auto-Paging" }); slide.addText(new List { new TextProps{ text= "Table Examples: ", options= DEMO_TITLE_TEXT }, new TextProps{ text= "Paging with smaller table area (50% width)", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 0.5, y = 0.13, w = "90%" } ); slide.addTable(arrRows, new TableProps { x = "50%", y = 0.5, colW = new List { 0.75, 1.75, 4 }, margin = 0.05, border = new BorderProps ("CFCFCF"), autoPage = true, verbose = false, }); } // EX-3= "Master Page with Auto-Paging" { slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: Auto-Paging", masterName = "MASTER_AUTO_PAGE_TABLE_PLACEHOLDER" }); slide.addText(new List{ new TextProps{ text= "Table Examples: ", options= DEMO_TITLE_TEXT }, new TextProps{ text= "Master Page with Auto-Paging", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 0.5, y = 0.13, w = "90%" }); slide.addText("Auto-Paging table", new TextPropsOptions { placeholder = "footer" }); slide.addTable(arrRows, new TableProps { x = 1.0, y = 0.6, colW = new List { 0.75, 1.75, 7 }, margin = 0.05, border = new BorderProps ("CFCFCF"), autoPage = true }); // HOWTO= In cases where you want to add custom text, placeholders, etc. to slidemasters, a reference to these slide(s) is needed // HOWTO= Use the `newAutoPagedSlides` to access references (see {Issue #625}(https://github.com/gitbrent/PptxGenJS/issues/625)) if (slide.autoPagedSlides != null) { foreach (var xslide in slide.autoPagedSlides) { xslide.addText("Auto-Paging table continued...", new TextPropsOptions { placeholder = "footer" }); } // slide.AutoPagedSlides.forEach((slide, _) => slide.AddText("Auto-Paging table continued...", new TextPropsOptions { placeholder = "footer" })); } } // EX-4= "Auto-Paging Disabled" { slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: Auto-Paging" }); slide.addText(new List{ new TextProps{ text= "Table Examples: ", options= DEMO_TITLE_TEXT }, new TextProps{ text= "Auto-Paging Disabled", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 0.5, y = 0.13, w = "90%" } ); slide.addTable(arrRows, new TableProps { x = 1.0, y = 0.6, colW = new List { 0.75, 1.75, 7 }, margin = 0.05, border = new BorderProps ("CFCFCF") }); // Negative-Test= no `autoPage=false` } // EX-5= "Start at `{ y= 4.0 }`, subsequent slides start at slide top margin" { slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: Auto-Paging", masterName = "MARGIN_SLIDE" }); slide.addText(new List{ new TextProps { text= "Table Examples: ", options= DEMO_TITLE_TEXT }, new TextProps { text= "Start at `{ y:4.0 }`, subsequent slides start at slide top margin", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 3.0, y = 0.75, w = "75%", h = 0.5 }); slide.addTable(arrRows, new TableProps { x = 3.0, y = 4.0, colW = new List { 0.75, 1.75, 7 }, margin = 0.05, border = new BorderProps ("CFCFCF"), fontFace = "Arial", autoPage = true, verbose = false, }); } // EX-6= "Start at `{ y= 4.0 }`, subsequent slides start at `{ autoPageSlideStartY= 1.5 }`" { slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: Auto-Paging", masterName = "MARGIN_SLIDE_STARTY15" }); slide.addText(new List{ new TextProps { text= "Table Examples: ", options= DEMO_TITLE_TEXT }, new TextProps { text= "Start at `{ y: 4.0 }`, subsequent slides start at `{ autoPageSlideStartY: 1.5 }`", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 3.0, y = 0.75, w = "75%", h = 0.5 } ); slide.addTable(arrRows, new TableProps { x = 3.0, y = 4.0, colW = new List { 0.75, 1.75, 7 }, margin = 0.05, border = new BorderProps ("CFCFCF"), autoPage = true, autoPageSlideStartY = 1.5, autoPageCharWeight = 0.15, verbose = false, }); } // EX-7= `autoPageRepeatHeader` option demos { pptx.addSection("Tables: Auto-Paging Repeat Header"); slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: Auto-Paging Repeat Header" }); slide.addText(new List{ new TextProps { text= "Table Examples: `autoPageHeaderRows`", options= DEMO_TITLE_TEXTBK }, new TextProps { text= "no `autoPageHeaderRows` prop", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 0.23, y = 0.13, w = 4, h = 0.4 } ); slide.addTable(arrRowsHead1, new TableProps { x = 0.23, y = 0.6, colW = new List { 0.5, 1.0, 2.5 }, margin = 0.05, border = new BorderProps ("CFCFCF"), autoPage = true, autoPageRepeatHeader = true, autoPageSlideStartY = 0.6, }); slide.addText(new List{ new TextProps { text = "Table Examples: autoPageHeaderRows", options= DEMO_TITLE_TEXTBK }, new TextProps { text = "`{ autoPageHeaderRows: 1 }`", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 4.75, y = 0.13, w = 4, h = 0.4 } ); slide.addTable(arrRowsHead1, new TableProps { x = 4.75, y = 0.6, colW = new List { 0.5, 1.0, 2.5 }, margin = 0.05, border = new BorderProps ("CFCFCF"), autoPage = true, autoPageRepeatHeader = true, autoPageHeaderRows = 1, autoPageSlideStartY = 0.6, }); slide.addText(new List{ new TextProps { text= "Table Examples: autoPageHeaderRows", options= DEMO_TITLE_TEXTBK }, new TextProps { text= "`{ autoPageHeaderRows: 2 }`", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 9.1, y = 0.13, w = 4, h = 0.4 } ); slide.addTable(arrRowsHead2, new TableProps { x = 9.1, y = 0.6, colW = new List { 0.5, 1.0, 2.5 }, margin = 0.05, border = new BorderProps ("CFCFCF"), autoPage = true, autoPageRepeatHeader = true, autoPageHeaderRows = 2, autoPageSlideStartY = 0.6, }); } // EX-8= `autoPageLineWeight` option demos { pptx.addSection("Tables: Auto-Paging LineWeight"); slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: Auto-Paging LineWeight" }); slide.addText(new List{ new TextProps { text= "Table Examples: Line Weight Options", options= DEMO_TITLE_TEXTBK }, new TextProps { text= "autoPageLineWeight:0.0", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 0.23, y = 0.13, w = 4, h = 0.4 } ); slide.addTable(arrText, new TableProps { x = 0.23, y = 0.6, w = 4, margin = 0.05, border = new BorderProps ("CFCFCF"), autoPage = true, autoPageLineWeight = 0.0 }); slide.addText(new List{ new TextProps { text = "Table Examples: Line Weight Options", options= DEMO_TITLE_TEXTBK }, new TextProps { text = "autoPageLineWeight:0.5", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 4.75, y = 0.13, w = 4, h = 0.4 } ); slide.addTable(arrText, new TableProps { x = 4.75, y = 0.6, w = 4, margin = 0.05, border = new BorderProps ("CFCFCF"), autoPage = true, autoPageLineWeight = 0.5 }); slide.addText(new List{ new TextProps { text= "Table Examples: Line Weight Options", options= DEMO_TITLE_TEXTBK }, new TextProps { text= "autoPageLineWeight:-0.5", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 9.1, y = 0.13, w = 4, h = 0.4 } ); slide.addTable(arrText, new TableProps { x = 9.1, y = 0.6, w = 4, margin = 0.05, border = new BorderProps ("CFCFCF"), autoPage = true, autoPageLineWeight = -0.5 }); } // EX-9= `autoPageCharWeight` option demos { pptx.addSection("Tables: Auto-Paging CharWeight"); slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: Auto-Paging CharWeight" }); slide.addText(new List{ new TextProps { text = "Table Examples: Char Weight Options", options= DEMO_TITLE_TEXTBK }, new TextProps { text = "autoPageCharWeight:0.0", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 0.23, y = 0.13, w = 4, h = 0.4 } ); slide.addTable(arrText, new TableProps { x = 0.23, y = 0.6, w = 4, margin = 0.05, border = new BorderProps ("CFCFCF"), autoPage = true, autoPageCharWeight = 0.0 }); slide.addText(new List{ new TextProps { text = "Table Examples: Char Weight Options", options= DEMO_TITLE_TEXTBK }, new TextProps { text = "autoPageCharWeight:0.25", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 4.75, y = 0.13, w = 4, h = 0.4 } ); slide.addTable(arrText, new TableProps { x = 4.75, y = 0.6, w = 4, margin = 0.05, border = new BorderProps ("CFCFCF"), autoPage = true, autoPageCharWeight = 0.25 }); slide.addText(new List{ new TextProps { text = "Table Examples: Char Weight Options", options= DEMO_TITLE_TEXTBK }, new TextProps { text = "autoPageCharWeight:-0.25", options= DEMO_TITLE_OPTS }, }, new TextPropsOptions { x = 9.1, y = 0.13, w = 4, h = 0.4 } ); slide.addTable(arrText, new TableProps { x = 9.1, y = 0.6, w = 4, margin = 0.05, border = new BorderProps ("CFCFCF"), autoPage = true, autoPageCharWeight = -0.25 }); } } /// /// SLIDE 8{...}= Table auto-paging with complex text array (unsupported until 3.7.2/3.8.0) /// /// public static void genSlide08(PptxGen pptx) { Slide slide = null!; var arrRows = new List(); slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: Auto-Paging Complex" }); slide.addNotes("API Docs: https://gitbrent.github.io/PptxGenJS/docs/api-tables.html"); slide.addText(new TextProps { text = "Table Examples: Auto-Paging Using Complex Text Example", options = DEMO_TITLE_TEXTBK }, new TextPropsOptions { x = 0.23, y = 0.13, w = 8, h = 0.4, }); // ------------ arrRows.Add(new TableRow { new TableCell { text= "ID#", options = new TableCellProps { fill= "0088cc", color= "ffffff", valign= VAlign.middle } }, new TableCell { text= "First Name", options = new TableCellProps { fill= "0088cc", color= "ffffff", valign= VAlign.middle } }, new TableCell { text= "Lorum Ipsum", options = new TableCellProps { fill= "0088cc", color= "ffffff", valign= VAlign.middle } }, }); var idx = 0; TABLE_NAMES_F.ForEach((name) => { var strText = idx == 0 ? LOREM_IPSUM.JsSubstring(0, 100) : LOREM_IPSUM.JsSubstring(idx * 100, idx * 200); arrRows.Add(new TableRow { new TableCell { text= idx, options = new TableCellProps { align= HAlign.center } }, new TableCell { text = name }, new TableCell { text= new TableRow{ new TableCell { text= "Title", options = new TableCellProps { bold= true, color= "FF0000", breakLine= true } }, new TableCell { text= $@">{strText}<" } } }, }); idx++; }); slide.addTable(arrRows, new TableProps { x = 0.5, y = 0.5, w = 8, colW = new List { 1, 1, 6 }, border = new BorderProps ("CFCFCF"), autoPage = true, autoPageRepeatHeader = true, verbose = false, }); } /// /// SLIDE 9{...}= Tightly calculated/labels rows and cells for precision auto-paging dev & test /// /// public static void genSlide09(PptxGen pptx) { Slide slide = null!; var arrRows = new List(); slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: Auto-Paging Calc" }); slide.addNotes("API Docs: https://gitbrent.github.io/PptxGenJS/docs/api-tables.html"); slide.addText(new TextProps { text = "Table Examples: Auto-Paging Calculations", options = DEMO_TITLE_TEXTBK }, new TextPropsOptions { x = 0.23, y = 0.13, w = 8, h = 0.4, }); // ------------ arrRows.Add(new TableRow { new TableCell { text= "TH1", options = new TableCellProps { fill= "0088cc", color= "ffffff", valign= VAlign.middle } }, new TableCell { text= "TH2", options = new TableCellProps { fill= "0088cc", color= "ffffff", valign= VAlign.middle } }, new TableCell { text= "TH3", options = new TableCellProps { fill= "0088cc", color= "ffffff", valign= VAlign.middle } }, }); for (var rowIdx = 0; rowIdx < 9; rowIdx++) { var col3Lines = new TableRow { new TableCell { text = "Complex-Title", options = new TableCellProps { bold = true, color = "FF0000", breakLine = true } } }; for (var lineIdx = 0; lineIdx < 9; lineIdx++) { col3Lines.Add(new TableCell { text = $@"This is ROW#:{rowIdx + 1} LNE#:{lineIdx + 1}", options = new TableCellProps { breakLine = true } }); } arrRows.Add(new TableRow { new TableCell { text = "" }, new TableCell { text = "" }, new TableCell { text = col3Lines } }); } slide.addTable(arrRows, new TableProps { x = 0.5, y = 0.75, w = 8, colW = new List { 1, 1, 6 }, border = new BorderProps("CFCFCF"), autoPage = true, autoPageRepeatHeader = true, verbose = false, }); } /// /// SLIDE 10{...}= Test paging with a single row; /// 最大到 Segment3; /// /// public static void genSlide10(PptxGen pptx) { Slide slide = null!; // SLIDE 1= { slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: QA 01" }); var projRows = new List { new TableRow { new TableCell { text= "id", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "First item Desc", options= new TableCellProps { bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Impact", options= new TableCellProps { bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Owner", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Created Date", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Due Date", options= new TableCellProps { bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Status", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Update", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } } }, new TableRow { new TableCell { text= "1" }, new TableCell { text= "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna.", }, new TableCell { text= "Adam" }, new TableCell { text= "Aenean commodo ligula eget dolor. Aenean massa." }, new TableCell { text= "20-10-2021" }, new TableCell { text= "01-11-2021" }, new TableCell { text= "Pending" }, new TableCell { text= "24-10-2021" }, }, }; slide.addTable(projRows, new TableProps { x = 0.4, y = 5.25, colW = new List { 0.5, 1.8, 5, 0.9, 1.0, 0.95, 0.8, 1.5 }, border = new BorderProps ("818181", null, 0.1), align = HAlign.left, valign = VAlign.middle, fontFace = "Segoe UI", fontSize = 8, autoPage = true, autoPageRepeatHeader = true, autoPageLineWeight = -0.4, //verbose = true, }); } // SLIDE 2= { slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: QA 02" }); var projRows2 = new List { new TableRow { new TableCell { text= "id", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "First item Desc", options= new TableCellProps { bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Impact", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Owner", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Created Date", options= new TableCellProps { bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Due Date", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Status", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Update", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, }, new TableRow { new TableCell { text= "1" }, new TableCell { text= "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna.", }, new TableCell { text= "" }, new TableCell { text= "" }, new TableCell { text= "" }, new TableCell { text= "" }, new TableCell { text= "" }, new TableCell { text= "" } }, }; slide.addTable(projRows2, new TableProps { x = 0.4, y = 5.25, colW = new List { 0.5, 1.8, 5, 0.9, 1.0, 0.95, 0.8, 1.5 }, border = new BorderProps("818181", null, 0.1), align = HAlign.left, valign = VAlign.middle, fontFace = "Segoe UI", fontSize = 8, autoPage = true, autoPageRepeatHeader = true, autoPageLineWeight = -0.4, //verbose = true, }); } // SLIDE 3= { slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: QA 03" }); var projRows3 = new List { new TableRow { new TableCell { text= "id", options= new TableCellProps { bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "First item Desc", options=new TableCellProps { bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Impact", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Owner", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Created Date", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Due Date", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Status", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Update", options= new TableCellProps{ bold= true, fill= "1F3864", color= "ffffff" } }, }, new TableRow { new TableCell { text= "1" }, new TableCell { text= "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna.", }, new TableCell { text= "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna.", }, new TableCell { text= "Aenean commodo ligula eget dolor. Aenean massa." }, new TableCell { text= "20-10-2021" }, new TableCell { text= "01-11-2021" }, new TableCell { text= "Pending" }, new TableCell { text= "24-10-2021" }, }, }; slide.addTable(projRows3, new TableProps { x = 0.4, y = 5.25, colW = new List { 0.5, 3.4, 3.4, 0.9, 1.0, 0.95, 0.8, 1.5 }, border = new BorderProps ("818181", null, 0.1), align = HAlign.left, valign = VAlign.middle, fontFace = "Segoe UI", fontSize = 8, autoPage = true, autoPageRepeatHeader = true, autoPageLineWeight = -0.4, // verbose = true, }); } // SLIDE 4: status report style { slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: QA 04" }); var projRows = new List { /*new TableRow { new TableCell { text= "id", options= new TableCellProps { bold= true, fill= "1F3864", color= "ffffff" } }, new TableCell { text= "Content", options= new TableCellProps{ bold= true, fill= "ffaacc", color= "ffffff" } }, }, new TableRow { new TableCell { text= "1" }, new TableCell { text= ConstantsTable.TABLE_AUTO_PAGE_TEST.Replace("\n", "").Replace("\r", "") }, },*/ new TableRow { new TableCell { text= "2" }, new TableCell { text= ConstantsTable.TABLE_AUTO_PAGE_TEST }, } }; slide.addTable(projRows, new TableProps { x = 0.4, y = 2.0, colW = new List { 0.5, 8.0 }, border = new BorderProps ("818181", null, 0.2), align = HAlign.left, valign = VAlign.middle, fontFace = "Arial", fontSize = 10, margin = 0.05, autoPage = true, autoPageCharWeight = -0.5, autoPageLineWeight = 1, autoPageSlideStartY = 0.7, autoPageRepeatHeader = true, autoPageHeaderRows = 1, //verbose= true, }); } } public static void genSlide11(PptxGen pptx) { var slide = pptx.addSlide(new AddSlideProps { sectionTitle = "Tables: QA 05" }); slide.addText(new List { new TextProps { text = "Table Examples: Auto-Paging with Hyperlinks", options = DEMO_TITLE_TEXTBK } }, new TextPropsOptions { x = 0.23, y = 0.13, w = 8, h = 0.4, }); // 共享同一个 options 实例; var options = new TableCellProps { fill = "AACCFF", hyperlink = 1 }; var baseTabRows = new TableRow[] { new TableRow { new TableCell { text = "white color", options = new TableCellProps { fill = "6699CC" , align = HAlign.left, color = "FFFFFF" } }, new TableCell { text= "yellow color", options = new TableCellProps { fill = "99AACC" , color= "FFFFAA" } }, new TableCell { text= "hyperlink here", options = options}, } }; var arrTabRows = new List(); for (var i = 0; i < 2; i++) { arrTabRows.Add(baseTabRows[0]); }; slide.addTable(arrTabRows, new TableProps { x = 0.5, y = 1.0, w = 10, autoPage = true }); } }