怎么将sql server数据库中的表转成java数组 博客
2016-07-13
展开全部
前段时间正好做了,导入和导出的,你自己看吧
/**导出数据为XLS格式
* @param fos
* @param bo
*/
public void writeExcelBo(FileOutputStream fos, java.util.Vector ve)
{
jxl.write.WritableWorkbook wwb;
try
{
wwb= Workbook.createWorkbook(fos);
jxl.write.WritableSheet ws= wwb.createSheet("booksheet", 10);
ws.addCell(new jxl.write.Label(0, 1, "书目ID"));
ws.addCell(new jxl.write.Label(1, 1, "ISBN"));
ws.addCell(new jxl.write.Label(2, 1, "定价"));
ws.addCell(new jxl.write.Label(3, 1, "书名"));
ws.addCell(new jxl.write.Label(4, 1, "原书名"));
ws.addCell(new jxl.write.Label(5, 1, "副题名"));
ws.addCell(new jxl.write.Label(6, 1, "著者"));
ws.addCell(new jxl.write.Label(7, 1, "译者"));
ws.addCell(new jxl.write.Label(8, 1, "版次"));
ws.addCell(new jxl.write.Label(9, 1, "出版地"));
ws.addCell(new jxl.write.Label(10, 1, "出版社"));
ws.addCell(new jxl.write.Label(11, 1, "出版日期"));
ws.addCell(new jxl.write.Label(12, 1, "页数"));
ws.addCell(new jxl.write.Label(13, 1, "书高"));
ws.addCell(new jxl.write.Label(14, 1, "装帧"));
ws.addCell(new jxl.write.Label(15, 1, "丛书名"));
ws.addCell(new jxl.write.Label(16, 1, "一般性附注项"));
ws.addCell(new jxl.write.Label(17, 1, "简介"));
ws.addCell(new jxl.write.Label(18, 1, "主题词"));
ws.addCell(new jxl.write.Label(19, 1, "中图法分类"));
ws.addCell(new jxl.write.Label(20, 1, "更新日期"));
ws.addCell(new jxl.write.Label(21, 1, "本数"));
book=new Book[ve.size()];
for (int i= 0; i < ve.size(); i++)
{
/**导出数据为XLS格式
* @param fos
* @param bo
*/
public void writeExcelBo(FileOutputStream fos, java.util.Vector ve)
{
jxl.write.WritableWorkbook wwb;
try
{
wwb= Workbook.createWorkbook(fos);
jxl.write.WritableSheet ws= wwb.createSheet("booksheet", 10);
ws.addCell(new jxl.write.Label(0, 1, "书目ID"));
ws.addCell(new jxl.write.Label(1, 1, "ISBN"));
ws.addCell(new jxl.write.Label(2, 1, "定价"));
ws.addCell(new jxl.write.Label(3, 1, "书名"));
ws.addCell(new jxl.write.Label(4, 1, "原书名"));
ws.addCell(new jxl.write.Label(5, 1, "副题名"));
ws.addCell(new jxl.write.Label(6, 1, "著者"));
ws.addCell(new jxl.write.Label(7, 1, "译者"));
ws.addCell(new jxl.write.Label(8, 1, "版次"));
ws.addCell(new jxl.write.Label(9, 1, "出版地"));
ws.addCell(new jxl.write.Label(10, 1, "出版社"));
ws.addCell(new jxl.write.Label(11, 1, "出版日期"));
ws.addCell(new jxl.write.Label(12, 1, "页数"));
ws.addCell(new jxl.write.Label(13, 1, "书高"));
ws.addCell(new jxl.write.Label(14, 1, "装帧"));
ws.addCell(new jxl.write.Label(15, 1, "丛书名"));
ws.addCell(new jxl.write.Label(16, 1, "一般性附注项"));
ws.addCell(new jxl.write.Label(17, 1, "简介"));
ws.addCell(new jxl.write.Label(18, 1, "主题词"));
ws.addCell(new jxl.write.Label(19, 1, "中图法分类"));
ws.addCell(new jxl.write.Label(20, 1, "更新日期"));
ws.addCell(new jxl.write.Label(21, 1, "本数"));
book=new Book[ve.size()];
for (int i= 0; i < ve.size(); i++)
{
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询