parent
7b1ca8e6f9
commit
014dad882d
@ -0,0 +1,32 @@
|
||||
package UnitTest.ImportExcel;
|
||||
|
||||
import com.dsideal.QingLong.Util.PoiUtil;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.xssf.usermodel.*;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TestDiffrentColor {
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
XSSFWorkbook wb = new XSSFWorkbook();
|
||||
XSSFSheet sheet = wb.createSheet("RichTextStringExample");
|
||||
|
||||
XSSFRow row = sheet.createRow(0);//行号
|
||||
XSSFCell cell = row.createCell(0);//单元格
|
||||
cell.setCellValue("我是原来的内容");
|
||||
|
||||
//添加重点提示符*和Comment
|
||||
PoiUtil.addStar(wb, cell);
|
||||
//添加Comment
|
||||
PoiUtil.addComment(wb, cell, "此单元格内容必须输入!");
|
||||
|
||||
//输出
|
||||
FileOutputStream fileOut = new FileOutputStream("c:\\workbook.xlsx");
|
||||
wb.write(fileOut);
|
||||
fileOut.close();
|
||||
wb.close();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue