From the example on "How to create tables", when I run the example in either POI-3.2 or POI-3.5, the table ignores "setFontSize". The PowerPoint generated has the table, but with a font size of 28. //table data String[][] data = { {"INPUT FILE", "NUMBER OF RECORDS"}, {"Item File", "11,559"}, {"Vendor File", "300"}, {"Purchase History File", "10,000"}, {"Total # of requisitions", "10,200,038"} }; SlideShow ppt = new SlideShow(); Slide slide = ppt.createSlide(); //create a table of 5 rows and 2 columns Table table = new Table(5, 2); for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[i].length; j++) { TableCell cell = table.getCell(i, j); cell.setText(data[i][j]); RichTextRun rt = cell.getTextRun().getRichTextRuns()[0]; rt.setFontName("Arial"); rt.setFontSize(10); cell.setVerticalAlignment(TextBox.AnchorMiddle); cell.setHorizontalAlignment(TextBox.AlignCenter); } } //set table borders Line border = table.createBorder(); border.setLineColor(Color.black); border.setLineWidth(1.0); table.setAllBorders(border); //set width of the 1st column table.setColumnWidth(0, 300); //set width of the 2nd column table.setColumnWidth(1, 150); slide.addShape(table); table.moveTo(100, 100); FileOutputStream out = new FileOutputStream("hslf-table.ppt"); ppt.write(out); out.close();
In addition to setFontSize() calls not working, calls to setFontName() and setBullet() also appear to have no effect.
Fixed in r710134 Yegor
I still see this issue in the 3.6 release, which I assume should contain the r710134 patches. Or, has this not tricked through to a released version yet?
I finally tracked down what was going on. My test code was making a called to RichtextRun.setBullet(false) on the text run in the table. This seems to disable the font settings. The offending code is shown commented out below. TableCell cell = table.getCell(i, j); cell.setText(data[i][j]); RichTextRun rt = cell.getTextRun().getRichTextRuns()[0]; rt.setFontName("Tahoma"); rt.setFontSize(10); //rt.setBullet(false); cell.setVerticalAlignment(TextBox.AnchorMiddle); cell.setHorizontalAlignment(TextBox.AlignCenter); I'm not sure if this is correct behavior, or not, but I can now workaround the issue. Wayne