FileDocCategorySizeDatePackage
HSSFFooter.javaAPI DocApache Poi 3.0.16966Mon Jan 01 12:39:36 GMT 2007org.apache.poi.hssf.usermodel

HSSFFooter

public class HSSFFooter extends Object
Class to read and manipulate the footer.

The footer works by having a left, center, and right side. The total cannot be more that 255 bytes long. One uses this class by getting the HSSFFooter from HSSFSheet and then getting or setting the left, center, and right side. For special things (such as page numbers and date), one can use a the methods that return the characters used to represent these. One can also change the fonts by using similar methods.

author
Shawn Laubach (slaubach at apache dot org)

Fields Summary
FooterRecord
footerRecord
String
left
String
center
String
right
Constructors Summary
protected HSSFFooter(FooterRecord footerRecord)
Constructor. Creates a new footer interface from a footer record

param
footerRecord Footer record to create the footer with

	this.footerRecord = footerRecord;
	String foot = footerRecord.getFooter();
	while (foot != null && foot.length() > 1) {
	    int pos = foot.length();
	    switch (foot.substring(1, 2).charAt(0)) {
	    case 'L" :
		if (foot.indexOf("&C") >= 0) {
		    pos = Math.min(pos, foot.indexOf("&C"));
		} 
		if (foot.indexOf("&R") >= 0) {
		    pos = Math.min(pos, foot.indexOf("&R"));
		} 
		left = foot.substring(2, pos);
		foot = foot.substring(pos);
		break;
	    case 'C" : 
		if (foot.indexOf("&L") >= 0) {
		    pos = Math.min(pos, foot.indexOf("&L"));
		} 
		if (foot.indexOf("&R") >= 0) {
		    pos = Math.min(pos, foot.indexOf("&R"));
		} 
		center = foot.substring(2, pos);
		foot = foot.substring(pos);
		break;
	    case 'R" : 
		if (foot.indexOf("&C") >= 0) {
		    pos = Math.min(pos, foot.indexOf("&C"));
		} 
		if (foot.indexOf("&L") >= 0) {
		    pos = Math.min(pos, foot.indexOf("&L"));
		} 
		right = foot.substring(2, pos);
		foot = foot.substring(pos);
		break;
	    default : foot = null;
	    }
	}
    
Methods Summary
private voidcreateFooterString()
Creates the complete footer string based on the left, center, and middle strings.

	footerRecord.setFooter(
			       "&C" + (center == null ? "" : center) +
			       "&L" + (left == null ? "" : left) +
			       "&R" + (right == null ? "" : right));
	footerRecord.setFooterLength((byte)footerRecord.getFooter().length());
    
public static java.lang.Stringdate()
Returns the string representing the current date

return
The special string for the date

	return "&D";
    
public static java.lang.StringendDoubleUnderline()
Returns the string representing the end double underline

return
The special string for end double underline

        return "&E";
    
public static java.lang.StringendUnderline()
Returns the string representing the end underline

return
The special string for end underline

        return "&U";
    
public static java.lang.Stringfile()
Returns the string representing the current file name

return
The special string for the file name

	return "&F";
    
public static java.lang.Stringfont(java.lang.String font, java.lang.String style)
Returns the string that represents the change in font.

param
font the new font
param
style the fonts style
return
The special string to represent a new font size

	return "&\"" + font + "," + style + "\"";
    
public static java.lang.StringfontSize(short size)
Returns the string that represents the change in font size.

param
size the new font size
return
The special string to represent a new font size

	return "&" + size;
    
public java.lang.StringgetCenter()
Get the center of the footer.

return
The string representing the center.

	return center;
    
public java.lang.StringgetLeft()
Get the left side of the footer.

return
The string representing the left side.

	return left;
    
public java.lang.StringgetRight()
Get the right side of the footer.

return
The string representing the right side.

	return right;
    
public static java.lang.StringnumPages()
Returns the string representing the number of pages.

return
The special string for the number of pages

	return "&N";
    
public static java.lang.Stringpage()
Returns the string representing the current page number

return
The special string for page number

	return "&P";
    
public voidsetCenter(java.lang.String newCenter)
Sets the center string.

param
newCenter The string to set as the center.

	center = newCenter;
	createFooterString();
    
public voidsetLeft(java.lang.String newLeft)
Sets the left string.

param
newLeft The string to set as the left side.

	left = newLeft;
	createFooterString();
    
public voidsetRight(java.lang.String newRight)
Sets the right string.

param
newRight The string to set as the right side.

	right = newRight;
	createFooterString();
    
public static java.lang.StringstartDoubleUnderline()
Returns the string representing the start double underline

return
The special string for start double underline

        return "&E";
    
public static java.lang.StringstartUnderline()
Returns the string representing the start underline

return
The special string for start underline

        return "&U";
    
public static java.lang.Stringtab()
Returns the string representing the current tab (sheet) name

return
The special string for tab name

	return "&A";
    
public static java.lang.Stringtime()
Returns the string representing the current time

return
The special string for the time

	return "&T";