poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frederick J. Ross" <f...@us.cd-adapco.com>
Subject HSLF setFontSize gets ignored in table
Date Fri, 17 Oct 2008 14:26:06 GMT
I am fairly new to working with POI. I have been working on building a
PowerPoint from scratch, and so far it has gone fairly well. I have been
able to add pictures, and moves (using POI.3.2-FINAL).

But I am having problems with tables. I tried the example code for a table,
but when I run it, the bullets are not suppressed, and I can't get the
correct font size. Now this might be partly due to reading the PowerPoint
into Office 2007, but I assume that it should still be compatible.

I was able to get the bullet suppressed by still including
"rt.setBulletChar". If I comment out the line with setBulletChar, then the
bullets show up. I believe if I also suppress "cell.setVerticalAlignment" or
"cell.setHorizontalAlignment", once again the bullets appear.

But nothing I have down gets the setFontSize(10) to be recognized.

Is there something I am missing?


        // TODO code application logic here
        //table data              
        String[][] data = {
            {"INPUT FILE", "NUMBER OF RECORDS"},
            {"New 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);
                RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];
                
                cell.setText(data[i][j]);

                rt.setFontSize(10);
                rt.setBullet(false);
                rt.setBulletOffset(0);  //bullet offset
                rt.setTextOffset(1);   //text offset (should be greater than
bullet offset)
                rt.setBulletChar('\u2022'); //bullet character
                
                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();



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message