到Excel导出,而它蕴含着巨大的数据 [英] Export to excel while it contains huge data

查看:108
本文介绍了到Excel导出,而它蕴含着巨大的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然我Excel导出具有巨大的数据(例如:100行)我得到以下警报,同时打开表。如果我们点击继续,它是开放在受保护的视图。

虽然我们保存这个Excel它提醒为无法在受保护的视图保存,如果我们着手的样式和字体设置在保存Excel工作表改变。

我能做些什么来避免这种情况?


解决方案

  // U可以在那里我们正在创建的细胞循环调用之前,这种风格的方法
   HSSFCellStyle yellowStyle = getYellowColoreBasedOnNewField(练习册);  私人HSSFCellStyle getYellowColoreBasedOnNewField(HSSFWorkbook工作簿){
    HSSFCellStyle风格= workBook.createCellStyle();
    HSSFFont字体= createAndSetFontStyle(练习册);
    setYellowColor(样式,字体);
    返回风格;
}    私人HSSFFont createAndSetFontStyle(HSSFWorkbook WB){
    HSSFFont字体= wb.createFont();
    font.setFontName(XSSFFont.DEFAULT_FONT_NAME);
    font.setFontHeightInPoints((短)10);
    返回字体;
}

While I am exporting excel which has huge data(ex:100 rows) I am getting below alert while opening sheet. And if we click on proceed,it is opening in protected view.

While we save this excel it is alerting as "unable to save in protected view" and if we proceed the styles and font settings are altered in the excel sheet saved.

What can I do to avoid this?

解决方案

  //u can call this style method before loops where we are creating cells
   HSSFCellStyle yellowStyle = getYellowColoreBasedOnNewField(workBook);     

  private HSSFCellStyle getYellowColoreBasedOnNewField(HSSFWorkbook workBook) {
    HSSFCellStyle style = workBook.createCellStyle();
    HSSFFont font = createAndSetFontStyle(workBook);
    setYellowColor(style, font);
    return style;
} 

    private HSSFFont createAndSetFontStyle(HSSFWorkbook wb) {
    HSSFFont font = wb.createFont();
    font.setFontName(XSSFFont.DEFAULT_FONT_NAME);
    font.setFontHeightInPoints((short)10);
    return font;
}

这篇关于到Excel导出,而它蕴含着巨大的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆