poi自动调整宽度
来源:互联网 发布:百度云管家mac版 编辑:程序博客网 时间:2024/05/20 18:16
I was also running into this issue and this was my solution.
Steps:
- Create workbook
- Create spreadsheet
- Create row
- Create/Set font to "Arial"
- Create/Set style with font
- Create/Set cell with value and style
- autoSizeColumn
- Create File
Code:
// initialize objectsXSSFWorkbook workbook = new XSSFWorkbook(); XSSFSheet spreadsheet = workbook.createSheet(sheetName);XSSFRow row = spreadsheet.createRow(0);XSSFCell cell;// font/styleXSSFFont font = workbook.createFont();font.setFontName("Arial");XSSFCellStyle style = workbook.createCellStyle();style.setFont(font);// create/set cell & stylecell = row.createCell(0);cell.setCellValue("New Cell");cell.setCellStyle(style);// auto sizespreadsheet.autoSizeColumn(0);// create fileFile aFile = new File("Your Filename");FileOutputStream out = new FileOutputStream(aFile);workbook.write(out);
Resources:
http://www.tutorialspoint.com/apache_poi/index.htm
需要设置字体
https://stackoverflow.com/questions/16943493/apache-poi-autosizecolumn-resizes-incorrectly
https://stackoverflow.com/questions/4611018/apache-poi-excel-how-to-configure-columns-to-be-expanded
阅读全文
0 0
- poi自动调整宽度
- UILabell自动调整宽度width
- jtable 根据内容自动调整表格宽度
- 自动调整宽度的图片按钮
- delphi自动调整combobox下拉列表宽度
- delphi自动调整combobox下拉列表宽度
- 网页宽度自动调整响应式网页
- 网页宽度自动调整响应式网页
- 自动调整DBGrid的列宽度
- UILabel自动调整大小(高度,宽度)
- UILabel自动调整大小(高度,宽度)
- viewport属性允许网页宽度自动调整
- Android textview自适应宽度自动调整字体大小
- 精准计算Excel POI自动列宽度(原创代码)
- 自动调整listview标题头宽度的二种方法
- 自动调整listview标题头宽度的二种方法
- 两个并列的div,一个确定宽度一个自动调整
- IE下按钮(button)根据内容自动调整宽度
- windows performance monitor
- android64位机器兼容32位.so库文件
- java标识符与关键
- 略仿今日头条部分功能,只供参考,娱乐而已(图片3秒跳转,无限轮播,webview,tablayout,listview,Xlistview)
- 阿里云Linux环境安装之JDK
- poi自动调整宽度
- hibernate事务
- 【NOIP2016提高A组模拟7.15】斐波那契数列(矩阵乘法)
- poj 2155 二维线段树或树状数组入门
- 深入浅出--Rxjava源码分析<一>
- 动态代理的一些思考
- 邻接表实现图论的各个算法
- 计算机网络知识的简单总结
- Git pull/push报错:disconnected no supported authentication methods available