Bug 50071 - Table.setRowHeight has no effect on row height
Summary: Table.setRowHeight has no effect on row height
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: HSLF (show other bugs)
Version: 3.7-dev
Hardware: All All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-11 01:17 UTC by Serge Aluker
Modified: 2015-11-16 23:29 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Serge Aluker 2010-10-11 01:17:43 UTC
The setRowHeight function does not work in 3.7beta2, nor 3.7beta3.

Sample code (height variable has no effect):

 int height = 135;

 SlideShow ppt = new SlideShow();
 Slide slide = ppt.createSlide();

 Table table = new Table(4, 4);
 int width = 50;
 TableCell cell = null;
 for (int i = 0; i < table.getNumberOfRows(); i++) {
     for (int j = 0; j < table.getNumberOfColumns(); j++) {
         cell = table.getCell(i, j);

         RichTextRun r = cell.getTextRun().getRichTextRuns()[0];
         r.setText("helloworld");
         r.setFontName("Arial");
         r.setFontSize(10);
         r.setTextOffset(0);	
     }
 }
 table.setAllBorders(new Line());
 slide.addShape(table);

 //set table dimensions		
 for (int i = 0; i < table.getNumberOfRows(); i++)
table.setRowHeight(i, height);
 for (int i = 0; i < table.getNumberOfColumns(); i++)
table.setColumnWidth(i, width);
 table.moveTo(50,50);


//save changes in a file
try {
	FileOutputStream out = new FileOutputStream("test.ppt");
		ppt.write(out);
		out.close();
} catch (IOException ex) {
		System.out.println("Trouble writing or closing out file!\n");
}
Comment 1 Nick Burch 2010-10-22 12:48:57 UTC
After changing the row height, does POI see the change? If you then save to a file, and re-read with POI, is the height change seen then?
Comment 2 Andreas Beeker 2015-11-16 23:29:02 UTC
This has been fixed ... I haven't checked when.
This was my test code:

@Test
public void testRowHeight() throws IOException {
    HSLFSlideShow ppt = new HSLFSlideShow();
    HSLFSlide slide = ppt.createSlide();
    HSLFTable tab = slide.createTable(4,  4);
    for (int row=0; row<4; row++) {
        for (int col=0; col<4; col++) {
            HSLFTableCell c = tab.getCell(row, col);
            HSLFTextRun tr = c.getTextParagraphs().get(0).getTextRuns().get(0);
            tr.setText("hello");
            tr.setFontFamily("Arial");
            tr.setFontSize(10.);
        }
    }
    new DrawTableShape(tab).setAllBorders(1., Color.black, 
StrokeStyle.LineDash.SOLID);
    tab.setRowHeight(2, 80);
    tab.moveTo(100, 100);
    
    FileOutputStream fos = new FileOutputStream("bla.ppt");
    ppt.write(fos);
    fos.close();
    
    ppt.close();
}