/**
* Generate the asset list to excel file according to the specified folder.
* @param path the output file name
*/
private void genAssetListExcel(String path)
{
Asset assets[] = epgdata.getAsset();
if(!this.isContainAsset(assets))
{
System.out.println("No assets should be generated to excel file");
return;
} String tmp = "";
try
{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("asset"); for( int i=0;i<assets.length;i++)
{
// Create a row and put some cells in it. Rows are 0 based.
HSSFRow row = sheet.createRow((short)i);
row.createCell((short)0).setCellValue(assets[i].getChannel() + java.io.File.separator + assets[i].getName());
row.createCell((short)1).setCellValue(mfutil.DateUtil.convertSecondsToTime(assets[i].getDuration()));
row.createCell((short)2).setCellValue(assets[i].getLogDate());
}
File f = new File(path);
if(f.exists() && f.isFile())
{
System.out.println("Deleting the excel file");
f.delete();
}
//Write excel
System.out.println("Writing the excel file " + path);
java.io.FileOutputStream fileOut = new java.io.FileOutputStream(path);
wb.write(fileOut);
fileOut.close(); }catch(java.io.FileNotFoundException e)
{
System.out.println("Can not write a asset list excel file:" + path);
}
catch(java.io.IOException e)
{
System.out.println("Write a asset list failed excel file:" + path);
}
}
* Generate the asset list to excel file according to the specified folder.
* @param path the output file name
*/
private void genAssetListExcel(String path)
{
Asset assets[] = epgdata.getAsset();
if(!this.isContainAsset(assets))
{
System.out.println("No assets should be generated to excel file");
return;
} String tmp = "";
try
{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("asset"); for( int i=0;i<assets.length;i++)
{
// Create a row and put some cells in it. Rows are 0 based.
HSSFRow row = sheet.createRow((short)i);
row.createCell((short)0).setCellValue(assets[i].getChannel() + java.io.File.separator + assets[i].getName());
row.createCell((short)1).setCellValue(mfutil.DateUtil.convertSecondsToTime(assets[i].getDuration()));
row.createCell((short)2).setCellValue(assets[i].getLogDate());
}
File f = new File(path);
if(f.exists() && f.isFile())
{
System.out.println("Deleting the excel file");
f.delete();
}
//Write excel
System.out.println("Writing the excel file " + path);
java.io.FileOutputStream fileOut = new java.io.FileOutputStream(path);
wb.write(fileOut);
fileOut.close(); }catch(java.io.FileNotFoundException e)
{
System.out.println("Can not write a asset list excel file:" + path);
}
catch(java.io.IOException e)
{
System.out.println("Write a asset list failed excel file:" + path);
}
}
解决方案 »
- java根据一个字段内容查询musql数据库中的信息 但是如果这个字段包含中文的话 就查询不了 该怎么办(该字段必须包含中文)
- Java Applet Heap Size 问题
- 急,在线等待,表但时间问题,解决给分
- 在tomcateclipse上运行servlet
- 提交之后页面不再跳转.而且页面也无任何提示信息
- struts2安装
- 开发jsp需不需要装J2EE????????????????????
- jsp叶面为什么没有提交???急急急
- 怎样判断数据库中有没有记录?
- 天呐~!这么大的事,俺竟然不知道~!
- 一个参数提交的问题!
- tomcat3下可以访问mysql数据库,换成tomcat4怎么就不行了?
import paytv.paytvutil;
import java.sql.*;
import java.io.RandomAccessFile;
import java.io.File;
import java.io.IOException;
import java.io.FileNotFoundException;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFCell;
import java.io.FileOutputStream;
import EPG.Schedule.*;
import java.util.ArrayList;
import EPG.Kasenna.*;