Click or drag to resize

Block Class

Represents a base class for all block elements.
Inheritance Hierarchy

Namespace:  SautinSoft.Document
Assembly:  SautinSoft.Document (in SautinSoft.Document.dll) Version:
public abstract class Block : Element

The Block type exposes the following members.

Public propertyContent
Gets the ContentRange of the current element.
(Inherited from Element.)
Public propertyDocument
Gets the owner document.
(Inherited from Element.)
Public propertyElementType
Gets the ElementType of this element instance.
(Inherited from Element.)
Public propertyNextSibling
Gets the next Element sibling.
(Inherited from Element.)
Public propertyParent
Gets the parent of this element instance.
(Inherited from Element.)
Public propertyParentCollection
Gets the BlockCollection that contains this Block instance.
Public propertyPreviuosSibling
Gets the previous Element sibling.
(Inherited from Element.)
Public methodAncestors (Inherited from Element.)
Public methodCode exampleClone
Clones this Block instance.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodCode exampleGetChildElements(Boolean)
Gets the child elements.
(Inherited from Element.)
Public methodCode exampleGetChildElements(Boolean, ElementType)
Gets the child elements filtered by ElementType.
(Inherited from Element.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
How to clone an element in DOCX document using C#
using System;
using SautinSoft.Document;
using System.IO;
using System.Linq;
using System.Text;

namespace Sample
    class Sample
        static void Main(string[] args)

        /// <summary>
        /// How to clone an element in DOCX document.
        /// </summary>
        /// <remarks>
        /// Details:
        /// </remarks>
        static void CloningElement()
            string filePath = @"..\..\Parsing.docx";
            string cloningFile = "Cloning.docx";
            DocumentCore dc = DocumentCore.Load(filePath);

            // Clone section.

            // Clone paragraphs.
            foreach (Block item in dc.Sections[0].Blocks)

            // Save the result.

            // Show the result.
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(filePath) { UseShellExecute = true });
            System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(cloningFile) { UseShellExecute = true });
How to clone an element in DOCX document using VB.Net
Imports System
Imports SautinSoft.Document
Imports System.IO
Imports System.Linq
Imports System.Text

Module Sample
    Sub Main()
    End Sub

    ''' <summary>
    ''' How to clone an element in DOCX document.
    ''' </summary>
    ''' <remarks>
    ''' Details:
    ''' </remarks>
    Sub CloningElement()
        Dim filePath As String = "..\Parsing.docx"
        Dim cloningFile As String = "Cloning.docx"
        Dim dc As DocumentCore = DocumentCore.Load(filePath)

        ' Clone section.

        ' Clone paragraphs.
        For Each item As Block In dc.Sections(0).Blocks
        Next item

        ' Save the result.

        ' Show the results.
        System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(filePath) With {.UseShellExecute = True})
        System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(cloningFile) With {.UseShellExecute = True})
    End Sub
End Module
See Also