大虾们好:
小弟现在需要编写入标题所言的特效,经过查阅相关资料,发现有insertRow等函数,但是不知道如何使用。请大家帮忙。 我的程序不是用JSP实现的,而是编写的APPLET。所用数据库SQL SERVER。
那位大侠帮帮我,十分感谢!
小弟现在需要编写入标题所言的特效,经过查阅相关资料,发现有insertRow等函数,但是不知道如何使用。请大家帮忙。 我的程序不是用JSP实现的,而是编写的APPLET。所用数据库SQL SERVER。
那位大侠帮帮我,十分感谢!
呵呵
import org.apache.commons.beanutils.DynaBean;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor.BLACK;
import org.apache.poi.hssf.util.HSSFColor.LIGHT_YELLOW;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;String strTempFileNm = "d:/template.xls";
FileInputStream fin = new java.io.FileInputStream(strTempFileNm);
POIFSFileSystem fs = new org.apache.poi.poifs.filesystem.POIFSFileSystem(fin);
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
wb.setSheetName(0,"MY SHEET1",HSSFCell.ENCODING_UTF_16);
HSSFRow row;
HSSFCell cell;
HSSFFont fontSize9 = wb.createFont();
HSSFCellStyle cellStyleYellow4Right = wb.createCellStyle();
cellStyleYellow4Right.setFillForegroundColor(LIGHT_YELLOW.index);
cellStyleYellow4Right.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
cellStyleYellow4Right.setBorderBottom(HSSFCellStyle.BORDER_THIN);
cellStyleYellow4Right.setBottomBorderColor(BLACK.index);
cellStyleYellow4Right.setBorderLeft(HSSFCellStyle.BORDER_THIN);
cellStyleYellow4Right.setLeftBorderColor(BLACK.index);
cellStyleYellow4Right.setBorderRight(HSSFCellStyle.BORDER_THIN);
cellStyleYellow4Right.setRightBorderColor(BLACK.index);
cellStyleYellow4Right.setBorderTop(HSSFCellStyle.BORDER_THIN);
cellStyleYellow4Right.setTopBorderColor(BLACK.index);
cellStyleYellow4Right.setVerticalAlignment(HSSFCellStyle.VERTICAL_TOP );
cellStyleYellow4Right.setAlignment(HSSFCellStyle.ALIGN_RIGHT );
cellStyleYellow4Right.setWrapText(true);
cellStyleYellow4Right.setFont(fontSize10);row = sheet.getRow(0);
cell = row.getCell((short) 0);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
wb.write(byteArrayOut);
byteArrayOut.close();
fin.close();