找回密码
 立即注册

QQ登录

只需一步,快速开始

wemeya

高级会员

2

主题

6

帖子

1422

积分

高级会员

积分
1422

活字格认证

最新发帖
wemeya
高级会员   /  发表于:2012-8-29 16:44  /   查看:5276  /  回复:3
大家好,我想知道指定区域的单元格的上、下、左、右、全、外边框以及边框线型、颜色该怎么设置?谢谢大家的帮助,还在学习阶段,请大家指教,谢谢!

3 个回复

倒序浏览
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2012-8-29 18:27:00
沙发
可以设置Border:
  1. fpSpread1.ActiveSheet.Cells[0, 0, 5, 5].Border = new FarPoint.Win.LineBorder(Color.Blue, 2, false, true, true, true);
复制代码


除了LineBorder类型外,还有多种边框类型,可以参考Spread帮助文章中的
Developer's Guide->Customizing Row, Column, and Cell Appearance->Customizing the Appearance of a Cell-> Customizing Cell Borders
回复 使用道具 举报
wemeya
高级会员   /  发表于:2012-8-29 18:51:00
板凳
嗯,我看过了,上面写错了,应该是选定区域,下面是我设左边框的代码,但是如何在设置了上边框,再设置下边框的时候,上边框还保留?这得加判断吗?还有有设所有边框的方法吗,我只找到了setoutlineborder设置外边框,然后线型和颜色如何设为用户自定义的?谢谢您不吝赐教。
FarPoint.Win.BevelBorder leftborder = new FarPoint.Win.BevelBorder(FarPoint.Win.BevelBorderType.Raised, Color.Black, Color.Black, 2, true ,false, false, false);
                this.fpSpread1.ActiveSheet.Cells[selectedCell.BeginRow, selectedCell.BeginCol, selectedCell.EndRow, selectedCell.EndCol].Border = leftborder;
回复 使用道具 举报
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2012-8-31 10:24:00
地板
回复 3楼wemeya的帖子

wemeya 你好

Spread中有两种设置边线的方法,一种是Border,一种是GridLine,详细请参考附件中的代码:



  1.     fpSpread1.ActiveSheet.HorizontalGridLine = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.Flat, Color.Red);
  2.     fpSpread1.ActiveSheet.VerticalGridLine = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.Flat, Color.Red);
复制代码


VS2010 + Spread .NET 6.0

5859_Border.zip (10.54 KB, 下载次数: 289)
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部