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
Wiki Markup
{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|Document] inherit from the [Element|Element] class.{excerpt}
{signature:C#}
 public class Element
{signature}{signature:vb.net}
Public Class Element
{signature}
{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:

{remarks}
{example}{code:csharp|title=C#}

          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:vb.net|title=vb.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:Element.CreateBookmark(String)|nopanel=true}|
|[CreateSectionAfter()|Element.CreateSectionAfter()]|{excerpt-include:Element.CreateSectionAfter()|nopanel=true}|
|[CreateSectionBefore()|Element.CreateSectionBefore()]|{excerpt-include:Element.CreateSectionBefore()|nopanel=true}|
|[DeleteElement()|Element.DeleteElement()]|{excerpt-include:Element.DeleteElement()|nopanel=true}|
|[GetElements(Element.Type)|Element.GetElements(Element.Type)]|{excerpt-include:Element.GetElements(Element.Type)|nopanel=true}|
|[GetPosition(Int32)|Element.GetPosition(Int32)]|{excerpt-include:Element.GetPosition(Int32)|nopanel=true}|
|[ImportData(Object()())|Element.ImportData(Object()())]|{excerpt-include:Element.ImportData(Object()())|nopanel=true}|
|[ImportData(Object()(), String(), DataImportProperties)|Element.ImportData(Object()(), String(), DataImportProperties)]|{excerpt-include:Element.ImportData(Object()(), String(), DataImportProperties)|nopanel=true}|
|[ImportData(System.Data.DataTable)|Element.ImportData(System.Data.DataTable)]|{excerpt-include:Element.ImportData(System.Data.DataTable)|nopanel=true}|
|[ImportData(System.Data.DataTable, DataImportProperties)|Element.ImportData(System.Data.DataTable, DataImportProperties)]|{excerpt-include:Element.ImportData(System.Data.DataTable, DataImportProperties)|nopanel=true}|
|[ImportData(System.Data.DataView)|Element.ImportData(System.Data.DataView)]|{excerpt-include:Element.ImportData(System.Data.DataView)|nopanel=true}|
|[ImportData(System.Data.DataView, DataImportProperties)|Element.ImportData(System.Data.DataView, DataImportProperties)]|{excerpt-include:Element.ImportData(System.Data.DataView, DataImportProperties)|nopanel=true}|
|[ImportData(Object(,))|Element.ImportData(Object(,))]|{excerpt-include:Element.ImportData(Object(,))|nopanel=true}|
|[ImportData(Object(,), String(), DataImportProperties)|Element.ImportData(Object(,), String(), DataImportProperties)]|{excerpt-include:Element.ImportData(Object(,), String(), DataImportProperties)|nopanel=true}|
|[ImportData(System.Data.IDataReader)|Element.ImportData(System.Data.IDataReader)]|{excerpt-include:Element.ImportData(System.Data.IDataReader)|nopanel=true}|
|[ImportData(System.Data.IDataReader, DataImportProperties)|Element.ImportData(System.Data.IDataReader, DataImportProperties)]|{excerpt-include:Element.ImportData(System.Data.IDataReader, DataImportProperties)|nopanel=true}|
|[InsertAfter(Element)|Element.InsertAfter(Element)]|{excerpt-include:Element.InsertAfter(Element)|nopanel=true}|
|[InsertBefore(Element)|Element.InsertBefore(Element)]|{excerpt-include:Element.InsertBefore(Element)|nopanel=true}|
|[InsertBreakAfter(Element.BreakType)|Element.InsertBreakAfter(Element.BreakType)]|{excerpt-include:Element.InsertBreakAfter(Element.BreakType)|nopanel=true}|
|[InsertBreakBefore(Element.BreakType)|Element.InsertBreakBefore(Element.BreakType)]|{excerpt-include:Element.InsertBreakBefore(Element.BreakType)|nopanel=true}|
|[InsertHyperlinkAfter(String, String)|Element.InsertHyperlinkAfter(String, String)]|{excerpt-include:Element.InsertHyperlinkAfter(String, String)|nopanel=true}|
|[InsertHyperlinkBefore(String, String)|Element.InsertHyperlinkBefore(String, String)]|{excerpt-include:Element.InsertHyperlinkBefore(String, String)|nopanel=true}|
|[InsertImageAfter(System.IO.Stream)|Element.InsertImageAfter(System.IO.Stream)]|{excerpt-include:Element.InsertImageAfter(System.IO.Stream)|nopanel=true}|
|[InsertImageAfter(String)|Element.InsertImageAfter(String)]|{excerpt-include:Element.InsertImageAfter(String)|nopanel=true}|
|[InsertImageBefore(String)|Element.InsertImageBefore(String)]|{excerpt-include:Element.InsertImageBefore(String)|nopanel=true}|
|[InsertImageBefore(System.IO.Stream)|Element.InsertImageBefore(System.IO.Stream)]|{excerpt-include:Element.InsertImageBefore(System.IO.Stream)|nopanel=true}|
|[InsertListAfter(Boolean)|Element.InsertListAfter(Boolean)]|{excerpt-include:Element.InsertListAfter(Boolean)|nopanel=true}|
|[InsertListBefore(Boolean)|Element.InsertListBefore(Boolean)]|{excerpt-include:Element.InsertListBefore(Boolean)|nopanel=true}|
|[InsertMergeFieldAfter(String, String)|Element.InsertMergeFieldAfter(String, String)]|{excerpt-include:Element.InsertMergeFieldAfter(String, String)|nopanel=true}|
|[InsertMergeFieldBefore(String, String)|Element.InsertMergeFieldBefore(String, String)]|{excerpt-include:Element.InsertMergeFieldBefore(String, String)|nopanel=true}|
|[InsertParagraphAfter(NamedStyle)|Element.InsertParagraphAfter(NamedStyle)]|{excerpt-include:Element.InsertParagraphAfter(NamedStyle)|nopanel=true}|
|[InsertParagraphAfter(NamedStyle, ParagraphFormatting)|Element.InsertParagraphAfter(NamedStyle, ParagraphFormatting)]|{excerpt-include:Element.InsertParagraphAfter(NamedStyle, ParagraphFormatting)|nopanel=true}|
|[InsertParagraphBefore(NamedStyle)|Element.InsertParagraphBefore(NamedStyle)]|{excerpt-include:Element.InsertParagraphBefore(NamedStyle)|nopanel=true}|
|[InsertParagraphBefore(NamedStyle, ParagraphFormatting)|Element.InsertParagraphBefore(NamedStyle, ParagraphFormatting)]|{excerpt-include:Element.InsertParagraphBefore(NamedStyle, ParagraphFormatting)|nopanel=true}|
|[InsertTableAfter(Int32, Int32)|Element.InsertTableAfter(Int32, Int32)]|{excerpt-include:Element.InsertTableAfter(Int32, Int32)|nopanel=true}|
|[InsertTableAfter(Int32, Int32, TableFormatting)|Element.InsertTableAfter(Int32, Int32, TableFormatting)]|{excerpt-include:Element.InsertTableAfter(Int32, Int32, TableFormatting)|nopanel=true}|
|[InsertTableBefore(Int32, Int32)|Element.InsertTableBefore(Int32, Int32)]|{excerpt-include:Element.InsertTableBefore(Int32, Int32)|nopanel=true}|
|[InsertTableBefore(Int32, Int32, TableFormatting)|Element.InsertTableBefore(Int32, Int32, TableFormatting)]|{excerpt-include:Element.InsertTableBefore(Int32, Int32, TableFormatting)|nopanel=true}|
|[InsertTextAfter(String, Boolean)|Element.InsertTextAfter(String, Boolean)]|{excerpt-include:Element.InsertTextAfter(String, Boolean)|nopanel=true}|
|[InsertTextAfter(String, Font)|Element.InsertTextAfter(String, Font)]|{excerpt-include:Element.InsertTextAfter(String, Font)|nopanel=true}|
|[InsertTextBefore(String, Boolean)|Element.InsertTextBefore(String, Boolean)]|{excerpt-include:Element.InsertTextBefore(String, Boolean)|nopanel=true}|
|[InsertTextBefore(String, Font)|Element.InsertTextBefore(String, Font)]|{excerpt-include:Element.InsertTextBefore(String, Font)|nopanel=true}|
|[Search(String)|Element.Search(String)]|{excerpt-include:Element.Search(String)|nopanel=true}|
|[SearchAndReplace(String, String)|Element.SearchAndReplace(String, String)]|{excerpt-include:Element.SearchAndReplace(String, String)|nopanel=true}|
|[SubElement(Int32, Int32)|Element.SubElement(Int32, Int32)]|{excerpt-include:Element.SubElement(Int32, Int32)|nopanel=true}|
{extensionMethods}
{introducedin:4.5}
||Overload||Description||
|[ImportData(Microsoft.SharePoint.SPList)|SharePointIntegration.ImportData(Element, Microsoft.SharePoint.SPList)]|{excerpt-include:SharePointIntegration.ImportData(Element, Microsoft.SharePoint.SPList)|nopanel=true}|
|[ImportData(Microsoft.SharePoint.SPView, Microsoft.SharePoint.SPList, DataImportProperties)|SharePointIntegration.ImportData(Element, Microsoft.SharePoint.SPView, Microsoft.SharePoint.SPList, DataImportProperties)]|{excerpt-include:SharePointIntegration.ImportData(Element, Microsoft.SharePoint.SPView, Microsoft.SharePoint.SPList, DataImportProperties)|nopanel=true}|
{classes}
||Name||Description||
|[BreakType|Element.BreakType]|{excerpt-include:Element.BreakType|nopanel=true}|
|[Type|Element.Type]|{excerpt-include:Element.Type|nopanel=true}|