如何在c#中机会工作表背景色 [英] How to chance worksheet backcolor in c#

查看:76
本文介绍了如何在c#中机会工作表背景色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

链接在那里

第二个链接在那里



我尝试过:



我想从蓝色变为白色。就像图片一样。

Link is there
Second link is there

What I have tried:

I want to change from blue to white color.Like in the pictures.

推荐答案

Excel.Style style = Globals.ThisWorkbook .Styles.Add(NewStyle,缺失);

style.Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.White);

style.Interior.Pattern = Excel.XlPattern.xlPatternSolid;

Microsoft.Office.Tools.Excel.NamedRange rangeStyles = this.Controls.AddNamedRange(this.Range [A1,missing], rangeStyles);

rangeStyles.Style =NewStyle;

rangeStyles.Columns.AutoFit();





使用C#代码更改Excel电子表格范围的背景颜色 [ ^ ]



尝试以下

.net - 使用C#更改单元格的背景 - 堆栈溢出 [ ^ ]
Excel.Style style = Globals.ThisWorkbook.Styles.Add("NewStyle", missing);
style.Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.White);
style.Interior.Pattern = Excel.XlPattern.xlPatternSolid;
Microsoft.Office.Tools.Excel.NamedRange rangeStyles = this.Controls.AddNamedRange(this.Range["A1", missing], "rangeStyles");
rangeStyles.Style = "NewStyle";
rangeStyles.Columns.AutoFit();


Using C# code to change the background color of an Excel spreadsheet range[^]

try below
.net - Change the background of Cells with C# - Stack Overflow[^]


从这里开始:

如何:以编程方式将颜色应用于Excel范围 [ ^ ]

使用Usin为Excel 2007工作表添加颜色g ColorIndex属性 [ ^ ]
Start here:
How to: Programmatically Apply Color to Excel Ranges[^]
Adding Color to Excel 2007 Worksheets by Using the ColorIndex Property[^]


我认为Excel没有任何选项来更改工作表背景颜色。我可以想到两种可能的方法:



- 选择所有单元格并更改颜色

- 在图形中创建编程所需颜色的矩形,然后选择它作为工作表背景
I think Excel does not have any option to change a worksheet background color. There are 2 possible ways to archieve this I can think of:

- Select all Cells and change their Color
- Create in a graphics program a rectangle in the desired color, and then select it as the sheet background


这篇关于如何在c#中机会工作表背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆