彩票走势图

在Aspose.Cells的单元格中如何添加边框

原创|其它|编辑:郝浩|2012-10-17 14:03:37.000|阅读 5395 次

概述:本文介绍了如何在Aspose.Cells的单元格中加上边框。

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

本文介绍了如何在Aspose.Cells的单元格中加上边框,代码如下:

//Instantiating a Workbook object
Workbook workbook = new Workbook();
 
//Obtaining the reference of the first (default) worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];
 
//Accessing the "A1" cell from the worksheet
Aspose.Cells.Cell cell = worksheet.Cells["A1"];
 
//Adding some value to the "A1" cell
cell.PutValue("Visit Aspose!");
            
//Create a style object
Style style = cell.GetStyle();
 
//Setting the line style of the top border
style.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thick;
 
//Setting the color of the top border
style.Borders[BorderType.TopBorder].Color = Color.Black;
 
//Setting the line style of the bottom border
style.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thick;
 
//Setting the color of the bottom border
style.Borders[BorderType.BottomBorder].Color = Color.Black;
 
//Setting the line style of the left border
style.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thick;
 
//Setting the color of the left border
style.Borders[BorderType.LeftBorder].Color = Color.Black;
 
//Setting the line style of the right border
style.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thick;
 
//Setting the color of the right border
style.Borders[BorderType.RightBorder].Color = Color.Black;
 
//Apply the border styles to the cell
cell.SetStyle(style); 
 
//Saving the Excel file
workbook.Save("C:\\book1.xls");

标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@cahobeh.cn

文章转载自:行游客的专栏-CSDN

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP