using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NPOI.HSSF.UserModel;
using NPOI.SS.Formula.Eval;
using NPOI.SS.Formula.Functions;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using NPOI.POIFS.FileSystem;
using NPOI.HPSF;
using System.IO;
using NPOI.SS.Util;
using System.Drawing;
using NPOI.HSSF.Util;
using NPOI.XSSF.Util;
namespace NPOI
{
class Program4
{
static void Main(string[] args)
{
//说明:设置单元格背景与图案
//1.创建EXCEL中的Workbook
IWorkbook myworkbook = new XSSFWorkbook();
//2.创建Workbook中的Sheet
ISheet mysheet = myworkbook.CreateSheet("sheet1");
mysheet.DefaultRowHeight = 30 * 20;
mysheet.SetColumnWidth(1, 30 * 256);
//3.创建Row中的Cell并赋值
IRow row0 = mysheet.CreateRow(0); row0.CreateCell(0).SetCellValue(""); row0.CreateCell(1).SetCellValue("NoFill");
IRow row1 = mysheet.CreateRow(1); row1.CreateCell(0).SetCellValue(""); row1.CreateCell(1).SetCellValue("SolidForeground");
IRow row2 = mysheet.CreateRow(2); row2.CreateCell(0).SetCellValue(""); row2.CreateCell(1).SetCellValue("FineDots");
IRow row3 = mysheet.CreateRow(3); row3.CreateCell(0).SetCellValue(""); row3.CreateCell(1).SetCellValue("AltBars");
IRow row4 = mysheet.CreateRow(4); row4.CreateCell(0).SetCellValue(""); row4.CreateCell(1).SetCellValue("SparseDots");
IRow row5 = mysheet.CreateRow(5); row5.CreateCell(0).SetCellValue(""); row5.CreateCell(1).SetCellValue("ThickHorizontalBands");
IRow row6 = mysheet.CreateRow(6); row6.CreateCell(0).SetCellValue(""); row6.CreateCell(1).SetCellValue("ThickVerticalBands");
IRow row7 = mysheet.CreateRow(7); row7.CreateCell(0).SetCellV
NPOI2.2.0.0实例详解(五)—设置EXCEL单元格背景与图案
最新推荐文章于 2023-04-26 15:52:27 发布