Giter Site home page Giter Site logo

easy-excel-utils's Introduction

easy-excel-utils

基于阿里easyExcel包装的工具类,poi版本3.17,主要简化easyExcel的web代码,增加一部分样式的定制操作

模块介绍

  • easy-excel-util #工具类依赖#
  • my-base-common #测试使用的其他依赖#
  • my-web #测试使用的web工程#

启动介绍

my-web基于SpringBoot ,默认不使用外置tomcat容器,使用外置容器时将WebServletInitializerConf的注释打开,并且将打包方式修改为war

调用AdminApplication中的Main方法启动内部tomcat容器

导出代码位置及调用示例

my-web中 EasyExcelUtilController

ExcelUtil.writeExcel(response,list,"导出测试","没有设定sheet名称", ExcelTypeEnum.XLSX,ExportTestModel.class);

导入

my-web中 EasyExcelUtilController

List<ExportTestModel> list = ExcelUtil.readExcel(files.get(0),ExportTestModel.class);

CellFontFormat

  • fontName

字体名称,直接翻译沉POI接口Font中的字体选择,String类型

  • fontHeightInPoints

字号大小,short类型

  • fontColor

字体颜色,POI,POI提供枚举中的IndexedColors

  • bold

是否加粗,默认false,类型boolean

关键代码:

Font font = sheet.getWorkbook().createFont(); font.setFontName(value.cellFont().fontName()); font.setColor(value.cellFont().fontColor().index); font.setFontHeightInPoints(value.cellFont().fontHeightInPoints()); font.setBold(value.cellFont().bold());

CellStyleFormat

  • horizontalAlignment

对齐方式,使用POI中的枚举HorizontalAlignment设置

  • fillBackgroundColor

背景颜色,使用POI中的枚举IndexedColors设置

style.setFillForegroundColor(value.fillBackgroundColor().index); style.setAlignment(value.horizontalalignment());

easy-excel-utils's People

Contributors

wangxiaoxiongjuly avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.