/**
* blob---》xls
*
* @param blob
* @return
* @see [类、类#方法、类#成员]
*/
public static String xls2String(Blob blob)
{
String result = "";
try
{
InputStream input = blob.getBinaryStream();
StringBuilder sb = new StringBuilder();
jxl.Workbook rwb = Workbook.getWorkbook(input);
Sheet[] sheet = rwb.getSheets();
for (int i = 0; i < sheet.length; i++)
{
Sheet rs = rwb.getSheet(i);
for (int j = 0; j < rs.getRows(); j++)
{
Cell[] cells = rs.getRow(j);
for (int k = 0; k < cells.length; k++)
sb.append(cells[k].getContents());
}
}
input.close();
result += sb.toString();
}
catch (Exception e)
{
e.printStackTrace();
}
return result;
}
java将数据库blob转xls
最新推荐文章于 2021-03-19 11:16:48 发布