Click or drag to resize
MultipleBordersIEnumerableGetEnumerator Method

Returns an enumerator that iterates through all SingleBorders supported in this MultipleBorders instance.

IEnumerable interface is required to support C# collection initializer syntax.

Namespace: GemBox.Document
Assembly: GemBox.Document (in GemBox.Document.dll) Version: 25.3.30.1231
Syntax
IEnumerator IEnumerable.GetEnumerator()

Return Value

Type: IEnumerator
An IEnumerator object that can be used to iterate through the collection.

Implements

IEnumerableGetEnumerator
Remarks

MultipleBorders class explicitly implements IEnumerable and contains public method Add(MultipleBorderTypes, BorderStyle, Color, Double) so it can be initialized using the C# collection initializer syntax like in the following example.

Examples

Following example shows how to initialize outside and inside table borders using the C# collection initializer syntax.

C#
// Create a new empty document.
var doc = new DocumentModel();

// Insert a 5x5 table with single red outside borders and dashed blue inside borders.
doc.Sections.Add(
    new Section(doc,
        new Table(doc, 5, 5)
        {
            TableFormat = new TableFormat()
            {
                Borders =
                {
                    { MultipleBorderTypes.Outside, BorderStyle.Single, Color.Red, 2 },
                    { MultipleBorderTypes.Inside, BorderStyle.Dashed, Color.Blue, 1 }
                }
            }
        }));

// Document will be saved to the Desktop.
var path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "BorderInitializer.docx");

// Save the document.
doc.Save(path);

// Open the document in Microsoft Word.
System.Diagnostics.Process.Start(path);
See Also