【发布时间】:2021-08-16 01:08:14
【问题描述】:
我正在使用 Migradoc 创建一个表格,我想为所有单元格设置阴影颜色和单元格边框。
此时我只能逐个单元格地做到这一点:
var tableRow = table.AddRow();
table.Cells[0].Shading.Color = Colors.LightBlue;
table.Cells[0].Format.LeftIndent = 1;
table.Cells[0].Borders.Color = Colors.White;
table.Cells[0].Borders.Width = 4;
table.Cells[1].Shading.Color = Colors.LightBlue;
table.Cells[1].Format.LeftIndent = 1;
table.Cells[1].Borders.Color = Colors.White;
table.Cells[1].Borders.Width = 4;
如果是在循环里面,就不会那么痛苦了,但是我所有的行都是一一创建的。
如何将这些属性设置为表格中的 ALL CELLS?
【问题讨论】:
-
“但是我的所有行都是一一创建的”是什么意思?这如何阻止您使用循环?
-
@Sweeper 我的意思是每一行都不是在循环中创建的,所以对于每一行,我必须以这种方式设置单元格格式。我想知道是否有办法为整个表格设置一次单元格格式。