footerrecord.java
来自「jexcelapi_2_4, JXL的API, JXL是JAVA读取EXCEL的」· Java 代码 · 共 128 行
JAVA
128 行
/*********************************************************************
*
* Copyright (C) 2002 Andrew Khan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
package jxl.write.biff;
import jxl.biff.Type;
import jxl.biff.IntegerHelper;
import jxl.biff.StringHelper;
import jxl.biff.WritableRecordData;
/**
* Places a string at the bottom of each page when the file is printed.
* JExcelApi sets this to be blank
*/
class FooterRecord extends WritableRecordData
{
/**
* The binary data
*/
private byte[] data;
/**
* The footer string
*/
private String footer;
/**
* Consructor
*
*
* @param l the print header to print on the left side
* @param c the print header to print in the centre
* @param r the print header to print on the right hand side
*/
public FooterRecord(String l, String c, String r)
{
super(Type.FOOTER);
StringBuffer sb = new StringBuffer();
if (l != null)
{
sb.append("&L");
sb.append(l);
}
if (c != null)
{
sb.append("&C");
sb.append(c);
}
if (r != null)
{
sb.append("&R");
sb.append(r);
}
footer = sb.toString();
}
/**
* Consructor invoked when copying a spreadsheet
*
* @param fr the read footer record
*/
public FooterRecord(jxl.read.biff.FooterRecord fr)
{
super(Type.FOOTER);
if (fr != null)
{
footer = fr.getFooter();
}
}
/**
* Consructor invoked when copying a sheets
*
* @param fr the read footer record
*/
public FooterRecord(FooterRecord fr)
{
super(Type.FOOTER);
footer = fr.footer;
}
/**
* Gets the binary data to write to the output file
*
* @return the binary data
*/
public byte[] getData()
{
if (footer == null || footer.length() == 0)
{
data = new byte[0];
return data;
}
data = new byte[footer.length() * 2 + 3];
IntegerHelper.getTwoBytes(footer.length(), data, 0);
data[2] = (byte) 0x1;
StringHelper.getUnicodeBytes(footer, data, 3);
return data;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?