1 2 17 18 19 package org.apache.poi.hssf.usermodel; 20 21 import junit.framework.TestCase; 22 import org.apache.poi.hssf.usermodel.HSSFHeader; 23 import org.apache.poi.hssf.usermodel.HSSFFooter; 24 import org.apache.poi.hssf.usermodel.HSSFSheet; 25 import org.apache.poi.hssf.usermodel.HSSFWorkbook; 26 27 import java.io.File ; 28 import java.io.FileInputStream ; 29 import java.io.FileOutputStream ; 30 31 37 38 public class TestHSSFHeaderFooter extends TestCase { 39 40 44 public TestHSSFHeaderFooter(String arg0) { 45 super(arg0); 46 } 47 48 53 public void testRetrieveCorrectHeader() throws Exception 54 { 55 String filename = System.getProperty( "HSSF.testdata.path" ); 57 filename = filename + "/EmbeddedChartHeaderTest.xls"; 58 FileInputStream fin = new FileInputStream ( filename ); 59 HSSFWorkbook wb = new HSSFWorkbook( fin ); 60 fin.close(); 61 HSSFSheet s = wb.getSheetAt( 0 ); 62 HSSFHeader head = s.getHeader(); 63 64 assertEquals("Top Left", head.getLeft()); 65 assertEquals("Top Center", head.getCenter()); 66 assertEquals("Top Right", head.getRight()); 67 } 68 69 74 public void testRetrieveCorrectFooter() throws Exception 75 { 76 String filename = System.getProperty( "HSSF.testdata.path" ); 78 filename = filename + "/EmbeddedChartHeaderTest.xls"; 79 FileInputStream fin = new FileInputStream ( filename ); 80 HSSFWorkbook wb = new HSSFWorkbook( fin ); 81 fin.close(); 82 HSSFSheet s = wb.getSheetAt( 0 ); 83 HSSFFooter foot = s.getFooter(); 84 85 assertEquals("Bottom Left", foot.getLeft()); 86 assertEquals("Bottom Center", foot.getCenter()); 87 assertEquals("Bottom Right", foot.getRight()); 88 } 89 } 90 91 | Popular Tags |