SetBorder

Table.SetBorder method

تعيين حدود الجدول المحددة إلى نمط الخط والعرض واللون المحددين.

public void SetBorder(BorderType borderType, LineStyle lineStyle, double lineWidth, Color color, 
    bool isOverrideCellBorders)
معامليكتبوصف
borderTypeBorderTypeحدود الجدول للتغيير.
lineStyleLineStyleنمط الخط المراد تطبيقه.
lineWidthDoubleعرض الخط الذي يجب تعيينه (بالنقاط).
colorColorاللون الذي يجب استخدامه للحدود.
isOverrideCellBordersBooleanمتىحقيقييؤدي ذلك إلى إزالة جميع حدود الخلايا الصريحة الموجودة.

أمثلة

يوضح كيفية تطبيق حدود تفصيلية على جدول.

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");

أنظر أيضا