TextureIndex

TextureIndex enumeration

指定着色纹理。

public enum TextureIndex

价值观

姓名价值描述
Texture10Percent3
Texture12Pt5Percent37
Texture15Percent38
Texture17Pt5Percent39
Texture20Percent4
Texture22Pt5Percent40
Texture25Percent5
Texture27Pt5Percent41
Texture2Pt5Percent35
Texture30Percent6
Texture32Pt5Percent42
Texture35Percent43
Texture37Pt5Percent44
Texture40Percent7
Texture42Pt5Percent45
Texture45Percent46
Texture47Pt5Percent47
Texture50Percent8
Texture52Pt5Percent48
Texture55Percent49
Texture57Pt5Percent50
Texture5Percent2
Texture60Percent9
Texture62Pt5Percent51
Texture65Percent52
Texture67Pt5Percent53
Texture70Percent10
Texture72Pt5Percent54
Texture75Percent11
Texture77Pt5Percent55
Texture7Pt5Percent36
Texture80Percent12
Texture82Pt5Percent56
Texture85Percent57
Texture87Pt5Percent58
Texture90Percent13
Texture92Pt5Percent59
Texture95Percent60
Texture97Pt5Percent61
TextureCross24
TextureDarkCross18
TextureDarkDiagonalCross19
TextureDarkDiagonalDown16
TextureDarkDiagonalUp17
TextureDarkHorizontal14
TextureDarkVertical15
TextureDiagonalCross25
TextureDiagonalDown22
TextureDiagonalUp23
TextureHorizontal20
TextureNone0
TextureSolid1
TextureVertical21
TextureNil65535指定当前阴影区域 上不应使用任何图案(即图案应完全填充背景颜色)。

例子

展示如何用边框和底纹装饰文本。

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

BorderCollection borders = builder.ParagraphFormat.Borders;
borders.DistanceFromText = 20;
borders[BorderType.Left].LineStyle = LineStyle.Double;
borders[BorderType.Right].LineStyle = LineStyle.Double;
borders[BorderType.Top].LineStyle = LineStyle.Double;
borders[BorderType.Bottom].LineStyle = LineStyle.Double;

Shading shading = builder.ParagraphFormat.Shading;
shading.Texture = TextureIndex.TextureDiagonalCross;
shading.BackgroundPatternColor = Color.LightCoral;
shading.ForegroundPatternColor = Color.LightSalmon;

builder.Write("This paragraph is formatted with a double border and shading.");
doc.Save(ArtifactsDir + "DocumentBuilder.ApplyBordersAndShading.docx");

演示如何将轮廓边框应用到表格。

Document doc = new Document(MyDir + "Tables.docx");
Table table = doc.FirstSection.Body.Tables[0];

// 将表格与页面中心对齐。
table.Alignment = TableAlignment.Center;

// 清除表格中任何现有的边框和阴影。
table.ClearBorders();
table.ClearShading();

// 将绿色边框添加到表格的轮廓。
table.SetBorder(BorderType.Left, LineStyle.Single, 1.5, Color.Green, true);
table.SetBorder(BorderType.Right, LineStyle.Single, 1.5, Color.Green, true);
table.SetBorder(BorderType.Top, LineStyle.Single, 1.5, Color.Green, true);
table.SetBorder(BorderType.Bottom, LineStyle.Single, 1.5, Color.Green, true);

// 用浅绿色纯色填充单元格。
table.SetShading(TextureIndex.TextureSolid, Color.LightGreen, Color.Empty);

doc.Save(ArtifactsDir + "Table.SetOutlineBorders.docx");

也可以看看