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;
namespace NPOI
{
class Program5
{
static void Main(string[] args)
{
//说明:设置单元格边框
//1.创建EXCEL中的Workbook
IWorkbook myworkbook = new XSSFWorkbook();
//2.创建Workbook中的Sheet
ISheet mysheet = myworkbook.CreateSheet("sheet1");
//3.创建Row中的Cell并赋值
IRow row0 = mysheet.CreateRow(0); row0.CreateCell(0).SetCellValue(""); row0.CreateCell(1).SetCellValue("Thin");
IRow row1 = mysheet.CreateRow(1); row1.CreateCell(0).SetCellValue(""); row1.CreateCell(1).SetCellValue("Medium");
IRow row2 = mysheet.CreateRow(2); row2.CreateCell(0).SetCellValue(""); row2.CreateCell(1).SetCellValue("Dashed");
IRow row3 = mysheet.CreateRow(3); row3.CreateCell(0).SetCellValue(""); row3.CreateCell(1).SetCellValue("Dotted");
IRow row4 = mysheet.CreateRow(4); row4.CreateCell(0).SetCellValue("
NPOI2.2.0.0实例详解(六)—设置EXCEL单元格边框
最新推荐文章于 2024-07-17 15:50:59 发布
本文通过C#代码展示了如何使用NPOI库创建Excel工作簿,并为单元格设置不同类型的边框,包括 Thin、Medium、Dashed、Dotted、Thick、Double、Hair、MediumDashed、DashDot、MediumDashDot、DashDotDot、MediumDashDotDot、SlantedDashDot,以及绘制斜线边框。
摘要由CSDN通过智能技术生成