poi java.awt android_java – Android POI:使用autoSizeColumn()时崩溃

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 21:00   2908   0

POI的autoSizeColumn方法抛出了我无法解决的异常:

"java.lang.ClassNotFoundException: Didn't find class "java.awt.font.FontRenderContext" on path:..."

有这个错误

"java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/font/FontRenderContext;"

这是我的代码,在将数据放入列后调用该方法:

private boolean saveExcelFile(Context context,String fileName) {

if (!isExternalStorageAvailable() || isExternalStorageReadOnly()) {

Log.e("ExcelLog","Storage not available or read only");

return false;

}

boolean success = false;

Cell c;

Workbook wb = new HSSFWorkbook();

CellStyle cs = wb.createCellStyle();

cs.setFillForegroundColor(HSSFColor.LIGHT_ORANGE.index);

cs.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);

Sheet sheet1;

sheet1 = wb.createSheet("Historique du "+date);

MultiFormatWriter writer = new MultiFormatWriter();

Bitmap ImageBitmap;

CreationHelper helper = wb.getCreationHelper();

Drawing drawing = sheet1.createDrawingPatriarch();

Row row = sheet1.createRow(0);

c = row.createCell(0);

c.setCellValue("Quantité");

c.setCellStyle(cs);

c = row.createCell(1);

c.setCellValue("Code barre");

c.setCellStyle(cs);

c = row.createCell(2);

c.setCellValue("Association");

c.setCellStyle(cs);

int m = 0;

for(int k=0;kFailed to save file",e);

} finally {

try {

if (null != os)

os.close();

} catch (Exception ignored) {

}

}

Toast.makeText(getApplicationContext(),"Success",Toast.LENGTH_LONG).show();

return success;

}

有人有任何线索可以帮助我吗?

提前致谢.

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP