惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Help Net Security
B
Blog RSS Feed
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
N
Netflix TechBlog - Medium
S
SegmentFault 最新的问题
The Cloudflare Blog
I
InfoQ
美团技术团队
博客园 - 三生石上(FineUI控件)
MyScale Blog
MyScale Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 司徒正美
L
LangChain Blog
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog

博客园 - stone

release 版本dll的调试 dead lock in thread pool 如何让iframe 自动适应窗口的高度 自定义Silverlight toolkit 里面的 Column Chart 的data point 二叉树算法题 How to do live debug the Managed code in Windows Phone 7 单链表操作相关算法 BUG: "Old format or invalid type library" error when automating Excel on 64 bit server 2008 - stone enable Assembly Load Trace 不合法的XML字符必须被替换为相应的实体 - stone - 博客园 如何修改 VS 自动生成的 COM interop dll VS中Sos调试扩展简介 (转帖) Sql server 2005 connection string - stone Get depth of BTree Quick sort C# code(2) Quick sort C# code use the network trace, from msdn. - stone 字节流编码获取原来这么复杂,但也很简单 通过DataTable获得表的主键 让IE支持自己的协议
Excel C# Automation
stone · 2011-08-09 · via 博客园 - stone

设置背景色

public void SetRangeBackground(int sRow,int sCol,int eRow,int eCol,int colorIndex)
{
range=objSheet.get_Range(objSheet.Cells[sRow,sCol],objSheet.Cells[eRow,eCol]);
range.Interior.ColorIndex=colorIndex;
}

设置边框

public void SetBorderLine(int sRow,int sCol,int eRow,int eCol)
{
range=objSheet.get_Range(objSheet.Cells[sRow,sCol],objSheet.Cells[eRow,eCol]);
range.Cells.Borders.LineStyle=1;

}

设置字体颜色

Excel.Range myrange=mysheet.get_Range(mysheet.Cells[1,1],mysheet.Cells[5,1]);
myrange.NumberFormatLocal="@";//文本格式

//设置第10行为红色
mysheet.get_Range((Excel.Range)mysheet.Cells[10,1],(Excel.Range)mysheet.Cells[10,200]).Select();
mysheet.get_Range((Excel.Range)mysheet.Cells[10,1],(Excel.Range)mysheet.Cells[10,200]).Interior.ColorIndex=3;   

mysheet.get_Range((Excel.Range)mysheet.Cells[10,1],(Excel.Range)mysheet.Cells[10,200]).Font.ColorIndex=3;   //字体是红色