|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
【求助】通过以下代码创建自定义样式,为什么生成的样式里,边框参数是失效的
我这里定义了上下边框,但是生成的自定义样式是无边框,求解?
另外,如果配置上所有边框,只有左边框会生效,但是颜色和样式也不对,这是啥情况?
excel重新试过两个版本,效果一样,目前是最新版本
- // 创建 "TT's Subtotal" 样式
- private void CreateTTsSubtotalStyle(Excel.Styles styles)
- {
- Excel.Style style = GetOrCreateStyle(styles, "TT's Subtotal");
- style.NumberFormat = "_(* #,##0_);_(* (#,##0);_(* "-"_);@_)";
- style.Font.Name = "Arial";
- style.Font.Bold = true;
- style.Font.Size = 9;
- style.Font.Color = System.Drawing.Color.FromArgb(222, 156, 0).ToArgb();
- style.Borders[Excel.XlBordersIndex.xlEdgeTop].LineStyle = Excel.XlLineStyle.xlContinuous;
- style.Borders[Excel.XlBordersIndex.xlEdgeTop].Color = System.Drawing.Color.FromArgb(222, 156, 0).ToArgb();
- style.Borders[Excel.XlBordersIndex.xlEdgeTop].Weight = Excel.XlBorderWeight.xlThin;
- style.Borders[Excel.XlBordersIndex.xlEdgeBottom].LineStyle = Excel.XlLineStyle.xlContinuous;
- style.Borders[Excel.XlBordersIndex.xlEdgeBottom].Color = System.Drawing.Color.FromArgb(222, 156, 0).ToArgb();
- style.Borders[Excel.XlBordersIndex.xlEdgeBottom].Weight = Excel.XlBorderWeight.xlThin;
- style.Interior.ColorIndex = -4142;
- style.HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft;
- style.VerticalAlignment = Excel.XlVAlign.xlVAlignBottom;
- style.WrapText = true;
- style.Locked = false;
- }
复制代码
|
-
|