FileInputStream fileInputStream = null; | |||||
BufferedOutputStream bufOutputStream = null; | |||||
try { | |||||
fileInputStream = new FileInputStream(FILENAME); | |||||
POIFSFileSystem poifsFileSystem = new POIFSFileSystem( | |||||
fileInputStream); | |||||
HSSFWorkbook workBook = new HSSFWorkbook(poifsFileSystem); | |||||
newSheet = workBook.createSheet(); | |||||
Iterator it = HSSFColor.getIndexHash().entrySet().iterator(); | |||||
int i = 0; | |||||
while (it.hasNext()) { | |||||
HSSFRow row = newSheet.createRow(i); | |||||
Entry entry = (Entry) it.next(); | |||||
HSSFCellStyle cellstyle = workBook.createCellStyle(); | |||||
cellstyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); | |||||
short ss = Short.parseShort(entry.getKey().toString()); | |||||
cellstyle.setFillForegroundColor(ss); | |||||
HSSFCell cell = row.createCell(0); | |||||
cell.setCellStyle(cellstyle); | |||||
cell = row.createCell(1); | |||||
cell.setCellValue(new HSSFRichTextString(HSSFColor | |||||
i++; | |||||
} |
color | org.apache.poi.hssf.util.HSSFColor$GREY_80_PERCENT@1aadbf7 |
color | org.apache.poi.hssf.util.HSSFColor$INDIGO@4f4458 |
color | org.apache.poi.hssf.util.HSSFColor$PLUM@100c56 |
color | org.apache.poi.hssf.util.HSSFColor$BROWN@19a1fae |
color | org.apache.poi.hssf.util.HSSFColor$OLIVE_GREEN@1960c9e |
color | org.apache.poi.hssf.util.HSSFColor$DARK_GREEN@168f39 |
color | org.apache.poi.hssf.util.HSSFColor$SEA_GREEN@11525cd |
color | org.apache.poi.hssf.util.HSSFColor$DARK_TEAL@164e67f |
color | org.apache.poi.hssf.util.HSSFColor$GREY_40_PERCENT@158cfda |
color | org.apache.poi.hssf.util.HSSFColor$BLUE_GREY@1b613c0 |
color | org.apache.poi.hssf.util.HSSFColor$ORANGE@cae1b3 |
color | org.apache.poi.hssf.util.HSSFColor$LIGHT_ORANGE@1a7e798 |
color | org.apache.poi.hssf.util.HSSFColor$GOLD@55d1ef |
color | org.apache.poi.hssf.util.HSSFColor$LIME@49b9ad |
color | org.apache.poi.hssf.util.HSSFColor$AQUA@3d0f0e |
color | org.apache.poi.hssf.util.HSSFColor$LIGHT_BLUE@a7624e |
color | org.apache.poi.hssf.util.HSSFColor$TAN@1271218 |
color | org.apache.poi.hssf.util.HSSFColor$LAVENDER@150b2d |
color | org.apache.poi.hssf.util.HSSFColor$ROSE@190c9dc |
color | org.apache.poi.hssf.util.HSSFColor$PALE_BLUE@b4bc8e |
color | org.apache.poi.hssf.util.HSSFColor$LIGHT_YELLOW@1c74456 |
color | org.apache.poi.hssf.util.HSSFColor$LIGHT_GREEN@15783a2 |
color | org.apache.poi.hssf.util.HSSFColor$LIGHT_TURQUOISE@830993 |
color | org.apache.poi.hssf.util.HSSFColor$SKY_BLUE@e99642 |
color | org.apache.poi.hssf.util.HSSFColor$BLUE@187f194 |
color | org.apache.poi.hssf.util.HSSFColor$TEAL@55f9f |
color | org.apache.poi.hssf.util.HSSFColor$DARK_RED@c8e08f |
color | org.apache.poi.hssf.util.HSSFColor$VIOLET@edd19 |
color | org.apache.poi.hssf.util.HSSFColor$TURQUOISE@1d5c7a1 |
color | org.apache.poi.hssf.util.HSSFColor$YELLOW@252119 |
color | org.apache.poi.hssf.util.HSSFColor$PINK@19ff062 |
color | org.apache.poi.hssf.util.HSSFColor$DARK_BLUE@15eb4d0 |
color | org.apache.poi.hssf.util.HSSFColor$LIGHT_CORNFLOWER_BLUE@b0e84b |
color | org.apache.poi.hssf.util.HSSFColor$ROYAL_BLUE@62a19d |
color | org.apache.poi.hssf.util.HSSFColor$CORAL@16075b3 |
color | org.apache.poi.hssf.util.HSSFColor$ORCHID@1cf46c2 |
color | org.apache.poi.hssf.util.HSSFColor$LIGHT_TURQUOISE@12e8a41 |
color | org.apache.poi.hssf.util.HSSFColor$LEMON_CHIFFON@76ec7a |
color | org.apache.poi.hssf.util.HSSFColor$PLUM@19f7952 |
color | org.apache.poi.hssf.util.HSSFColor$CORNFLOWER_BLUE@d60cdd |
color | org.apache.poi.hssf.util.HSSFColor$GREY_50_PERCENT@e6bc11 |
color | org.apache.poi.hssf.util.HSSFColor$GREY_25_PERCENT@452267 |
color | org.apache.poi.hssf.util.HSSFColor$TEAL@d5b614 |
color | org.apache.poi.hssf.util.HSSFColor$VIOLET@a4e3ae |
color | org.apache.poi.hssf.util.HSSFColor$DARK_YELLOW@15fd4a3 |
color | org.apache.poi.hssf.util.HSSFColor$DARK_BLUE@8137c9 |
color | org.apache.poi.hssf.util.HSSFColor$GREEN@1757596 |
color | org.apache.poi.hssf.util.HSSFColor$DARK_RED@7ad4d5 |
color | org.apache.poi.hssf.util.HSSFColor$TURQUOISE@2aee3f |
color | org.apache.poi.hssf.util.HSSFColor$PINK@7f788b |
color | org.apache.poi.hssf.util.HSSFColor$YELLOW@c311d5 |
color | org.apache.poi.hssf.util.HSSFColor$BLUE@c7e580 |
color | org.apache.poi.hssf.util.HSSFColor$BRIGHT_GREEN@1ac55ac |
color | org.apache.poi.hssf.util.HSSFColor$RED@12cc460 |
color | org.apache.poi.hssf.util.HSSFColor$WHITE@10ad7e |
color | org.apache.poi.hssf.util.HSSFColor$BLACK@ee336f |
相关推荐
apache.poi.hssf.util.HSSFColor; import org.apache.poi.hssf.util.Region; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.ss.util.CellRangeAddress; "The import org.apache...
import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.hssf.util.Region; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.ss.util.CellRangeAddress; "The import ...
color org.apache.poi.hssf.util.HSSFColor$GREY_80_PERCENT@1aadbf7 color org.apache.poi.hssf.util.HSSFColor$INDIGO@4f4458 color org.apache.poi.hssf.util.HSSFColor$PLUM@100c56 color org.apache.poi....
import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.FillPatternType; import org.apache....
Apache POI提供了HSSF(Horrible Spreadsheet Format)和XSSF(XML Spreadsheet Format)两个API,分别用于处理旧版的.xls文件和较新的.xlsx文件。在处理包含图片的Excel文件时,我们通常会使用XSSF,因为它支持更多...
import org.apache.poi.hssf.util.HSSFColor; 先看poi的examples包中提供的最简单的例子,建立一个空xls文件。 import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.hssf....
style.setFillForegroundColor(HSSFColor.LIGHT_GREEN.index); style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); HSSFFont font = wb.createFont(); font.setFontHeightInPoints((short) 11); style....
short color = HSSFColor.RED.index; // 设置颜色 font.setColor(color); style.setFont(font); // 应用字体样式 cell.setCellStyle(style); // 应用样式 cell.setCellValue((String) fieldName.get(j)); // ...
cellStyle.setFillForegroundColor(HSSFColor.HSSFColorPredefined.LIGHT_TURQUOISE.getIndex()); cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); ``` 5. **表头样式**: ```java HSSFCellStyle ...
这通常涉及遍历每一行并为每行创建一个新的Excel行,然后根据列索引将单元格值填充到相应的单元格中。 ##### 3.7 保存Excel文件 最后一步是将创建好的Excel文件保存到磁盘上。这可以通过调用`FileStream`对象和`...