日期:2014-05-17  浏览次数:20822 次

高分求助,使用poi 如何实现 缩小字体填充
本帖最后由 zhuangwei_ 于 2013-02-27 17:45:45 编辑
如题,高分求助,使用poi 如何实现 缩小字体填充
poi?缩小字体填充 poi 缩小字体填充

------解决方案--------------------
请问LZ解决了么~
------解决方案--------------------

------解决方案--------------------
过来看看解决的怎么样  这个不会弄 学习一下
------解决方案--------------------
引用:
本帖最后由 zhuangwei_ 于 2013-02-27 17:45:45 编辑
            如题,高分求助,使用poi 如何实现 缩小字体填充
              
                  poi 缩小字体填充
                  poi
                  缩小字体填充
            ……

给个效果,在execl中截个效果图我看看。
------解决方案--------------------

//POI官网的一些例子
Cell c = null;
// create 3 cell styles
CellStyle cs = wb.createCellStyle();
CellStyle cs2 = wb.createCellStyle();
CellStyle cs3 = wb.createCellStyle();
DataFormat df = wb.createDataFormat();
// create 2 fonts objects
Font f = wb.createFont();
Font f2 = wb.createFont();

//set font 1 to 12 point type
f.setFontHeightInPoints((short) 12);
//make it blue
f.setColor( (short)0xc );
// make it bold
//arial is the default font
f.setBoldweight(Font.BOLDWEIGHT_BOLD);

//set font 2 to 10 point type
f2.setFontHeightInPoints((short) 10);
//make it red
f2.setColor( (short)Font.COLOR_RED );
//make it bold
f2.setBoldweight(Font.BOLDWEIGHT_BOLD);

f2.setStrikeout( true );

//set cell stlye
cs.setFont(f);