Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Description

Excerpt

This class is used to represent a region of the document that can be edited. This is the main class for manipulating the Word object model. Most elements of a Document inherit from the Element class.

Signature
C#
C#

<p> public class Element</p>
Signature
vb.net
vb.net

<p>Public Class Element</p>
Remarks

You cannot create a new Element object by using the new keyword. There are various properties

The following sample demonstrates getting an Element object by retrieving a section's header:

Example
Code Block
csharp
csharp
titleC#


          WordApplication app = new WordApplication();
          Document doc = app.Open(@"C:\sample.doc");
          Section sect = doc.Sections[0];
          Element e = sect.GetHeader(Section.HeaderFooterType.All);
        
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}


          Dim app As New WordApplication()
          Dim doc As Document = app.Open("C:\sample.doc")
          Dim sect As Section = doc.Sections(0)
          Dim e As Element = sect.GetHeader(Section.HeaderFooterType.All)
        
{code} {example} {properties} ||Name||Description|| |[Children|Element.Children]|{excerpt-include:Element.Children|nopanel=true}| |[ElementType|Element.ElementType]|{excerpt-include:Element.ElementType|nopanel=true}| |[Length|Element.Length]|{excerpt-include:Element.Length|nopanel=true}| |[Start|Element.Start]|{excerpt-include:Element.Start|nopanel=true}| |[Text|Element.Text]|{excerpt-include:Element.Text|nopanel=true}| {methods} ||Name||Description|| |[CreateBookmark(String)|Element.CreateBookmark(String)]|{excerpt-include:
Properties

Name

Description

Children

Excerpt Include
Element.Children
Element.Children
nopaneltrue

ElementType

Excerpt Include
Element.ElementType
Element.ElementType
nopaneltrue

Length

Excerpt Include
Element.Length
Element.Length
nopaneltrue

Start

Excerpt Include
Element.Start
Element.Start
nopaneltrue

Text

Excerpt Include
Element.Text
Element.Text
nopaneltrue
Methods

Name

Description

CreateBookmark(String)

Excerpt Include
Element.CreateBookmark(String)
Element.CreateBookmark(String)

...

nopanel

...

...

Excerpt Include
Element.CreateSectionAfter()

...

Element.CreateSectionAfter()

...

nopanel

...

...

Excerpt Include
Element.CreateSectionBefore()

...

Element.CreateSectionBefore()

...

nopanel

...

...

Excerpt Include
Element.DeleteElement()

...

Element.DeleteElement()

...

nopanel

...

...

Excerpt Include
Element.GetElements(Element.Type)

...

Element.GetElements(Element.Type)

...

nopanel

...

...

Excerpt Include
Element.GetPosition(Int32)

...

Element.GetPosition(Int32)

...

nopanel

...

...

Excerpt Include
Element.ImportData(Object()())

...

Element.ImportData(Object()())

...

nopanel

...

...

...

...

Excerpt Include
Element.ImportData(Object()(),

...

String(),

...

DataImportProperties)

...

Element.ImportData(Object()(),

...

String(),

...

DataImportProperties)

...

nopanel

...

...

Excerpt Include
Element.ImportData(System.Data.DataTable)

...

Element.ImportData(System.Data.DataTable)

...

nopanel

...

...

...

Excerpt Include
Element.ImportData(System.Data.DataTable,

...

DataImportProperties)

...

Element.ImportData(System.Data.DataTable,

...

DataImportProperties)

...

nopanel

...

...

Excerpt Include
Element.ImportData(System.Data.DataView)

...

Element.ImportData(System.Data.DataView)

...

nopanel

...

...

...

Excerpt Include
Element.ImportData(System.Data.DataView,

...

DataImportProperties)

...

Element.ImportData(System.Data.DataView,

...

DataImportProperties)

...

nopanel

...

...

Excerpt Include
Element.ImportData(Object(,))

...

Element.ImportData(Object(,))

...

nopanel

...

...

...

...

Excerpt Include
Element.ImportData(Object(,),

...

String(),

...

DataImportProperties)

...

Element.ImportData(Object(,),

...

String(),

...

DataImportProperties)

...

nopanel

...

...

Excerpt Include
Element.ImportData(System.Data.IDataReader)

...

Element.ImportData(System.Data.IDataReader)

...

nopanel

...

...

...

Excerpt Include
Element.ImportData(System.Data.IDataReader,

...

DataImportProperties)

...

Element.ImportData(System.Data.IDataReader,

...

DataImportProperties)

...

nopanel

...

...

Excerpt Include
Element.InsertAfter(Element)

...

Element.InsertAfter(Element)

...

nopanel

...

...

Excerpt Include
Element.InsertBefore(Element)

...

Element.InsertBefore(Element)

...

nopanel

...

...

Excerpt Include
Element.InsertBreakAfter(Element.BreakType)

...

Element.InsertBreakAfter(Element.BreakType)

...

nopanel

...

...

Excerpt Include
Element.InsertBreakBefore(Element.BreakType)

...

Element.InsertBreakBefore(Element.BreakType)

...

nopanel

...

...

...

Excerpt Include
Element.InsertHyperlinkAfter(String,

...

String)

...

Element.InsertHyperlinkAfter(String,

...

String)

...

nopanel

...

...

...

Excerpt Include
Element.InsertHyperlinkBefore(String,

...

String)

...

Element.InsertHyperlinkBefore(String,

...

String)

...

nopanel

...

...

Excerpt Include
Element.InsertImageAfter(System.IO.Stream)

...

Element.InsertImageAfter(System.IO.Stream)

...

nopanel

...

...

Excerpt Include
Element.InsertImageAfter(String)

...

Element.InsertImageAfter(String)

...

nopanel

...

...

Excerpt Include
Element.InsertImageBefore(String)

...

Element.InsertImageBefore(String)

...

nopanel

...

...

Excerpt Include
Element.InsertImageBefore(System.IO.Stream)

...

Element.InsertImageBefore(System.IO.Stream)

...

nopanel

...

...

Excerpt Include
Element.InsertListAfter(Boolean)

...

Element.InsertListAfter(Boolean)

...

nopanel

...

...

Excerpt Include
Element.InsertListBefore(Boolean)

...

Element.InsertListBefore(Boolean)

...

nopanel

...

...

...

Excerpt Include
Element.InsertMergeFieldAfter(String,

...

String)

...

Element.InsertMergeFieldAfter(String,

...

String)

...

nopanel

...

...

...

Excerpt Include
Element.InsertMergeFieldBefore(String,

...

String)

...

Element.InsertMergeFieldBefore(String,

...

String)

...

nopanel

...

...

Excerpt Include
Element.InsertParagraphAfter(NamedStyle)

...

Element.InsertParagraphAfter(NamedStyle)

...

nopanel

...

...

...

Excerpt Include
Element.InsertParagraphAfter(NamedStyle,

...

ParagraphFormatting)

...

Element.InsertParagraphAfter(NamedStyle,

...

ParagraphFormatting)

...

nopanel

...

...

Excerpt Include
Element.InsertParagraphBefore(NamedStyle)

...

Element.InsertParagraphBefore(NamedStyle)

...

nopanel

...

...

...

Excerpt Include
Element.InsertParagraphBefore(NamedStyle,

...

ParagraphFormatting)

...

Element.InsertParagraphBefore(NamedStyle,

...

ParagraphFormatting)

...

nopanel

...

...

...

Excerpt Include
Element.InsertTableAfter(Int32,

...

Int32)

...

Element.InsertTableAfter(Int32,

...

Int32)

...

nopanel

...

...

...

...

Excerpt Include
Element.InsertTableAfter(Int32,

...

Int32,

...

TableFormatting)

...

Element.InsertTableAfter(Int32,

...

Int32,

...

TableFormatting)

...

nopanel

...

...

...

Excerpt Include
Element.InsertTableBefore(Int32,

...

Int32)

...

Element.InsertTableBefore(Int32,

...

Int32)

...

nopanel

...

...

...

...

Excerpt Include
Element.InsertTableBefore(Int32,

...

Int32,

...

TableFormatting)

...

Element.InsertTableBefore(Int32,

...

Int32,

...

TableFormatting)

...

nopanel

...

...

...

Excerpt Include
Element.InsertTextAfter(String,

...

Boolean)

...

Element.InsertTextAfter(String,

...

Boolean)

...

nopanel

...

...

...

Excerpt Include
Element.InsertTextAfter(String,

...

Font)

...

Element.InsertTextAfter(String,

...

Font)

...

nopanel

...

...

...

Excerpt Include
Element.InsertTextBefore(String,

...

Boolean)

...

Element.InsertTextBefore(String,

...

Boolean)

...

nopanel

...

...

...

Excerpt Include
Element.InsertTextBefore(String,

...

Font)

...

Element.InsertTextBefore(String,

...

Font)

...

nopanel

...

...

Excerpt Include
Element.Search(String)

...

Element.Search(String)

...

nopanel

...

...

...

Excerpt Include
Element.SearchAndReplace(String,

...

String)

...

Element.SearchAndReplace(String,

...

String)

...

nopanel

...

...

...

Excerpt Include
Element.SubElement(Int32,

...

Int32)

...

Element.SubElement(Int32,

...

Int32)

...

nopanel

...

true
Extensionmethods
Introducedin
4.5
4.5

...

Excerpt Include
SharePointIntegration.ImportData(Element,

...

Microsoft.SharePoint.SPList)

...

SharePointIntegration.ImportData(Element,

...

Microsoft.SharePoint.SPList)

...

nopanel

...

...

...

...

Excerpt Include
SharePointIntegration.ImportData(Element,

...

Microsoft.SharePoint.SPView,

...

Microsoft.SharePoint.SPList,

...

DataImportProperties)

...

SharePointIntegration.ImportData(Element,

...

Microsoft.SharePoint.SPView,

...

Microsoft.SharePoint.SPList,

...

DataImportProperties)

...

nopanel

...

true
Classes

Name

Description

BreakType

Excerpt Include
Element.BreakType
Element.BreakType
nopaneltrue

Type

Excerpt Include
Element.Type
Element.Type
nopaneltrue