EditableRangeCollection Class
Represents a collection of EditableRange objects within the Word document.
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Base.dll
Syntax
public class EditableRangeCollection : CollectionImpl
Properties
Item[Int32]
Declaration
public EditableRange this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type |
---|
EditableRange |
Item[String]
Gets the EditableRange with the specified ID.
Declaration
public EditableRange this[string id] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The string that represents the ID of the editable range in the document to retrieve. |
Property Value
Type | Description |
---|---|
EditableRange | The EditableRange with the specified ID. |
Examples
The following example illustrates how to get an editable range from a Word document using its ID.
// Load an existing Word document into the DocIO instance
WordDocument document = new WordDocument("Template.docx");
// Get the editable range by ID
EditableRange editableRange = document.EditableRanges["0"];
// Remove the editable range from the Word document
document.EditableRanges.Remove(editableRange);
// Save the document with the given name and format.
document.Save("Sample.docx", FormatType.Docx);
// Close the document and release resources
document.Close();
' Load an existing Word document into the DocIO instance
Dim document As New WordDocument("Template.docx")
' Get the editable range by ID
Dim editableRange As EditableRange = document.EditableRanges("0")
' Remove the editable range from the Word document
document.EditableRanges.Remove(editableRange)
' Save the document with the given name and format
document.Save("Sample.docx", FormatType.Docx)
' Close the document and release resources
document.Close()
Methods
FindById(String)
Finds the EditableRange with the specified ID in the document.
Declaration
public EditableRange FindById(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The string that represents the ID of the editable range to find. |
Returns
Type | Description |
---|---|
EditableRange | The EditableRange with the specified ID if found; otherwise, |
Examples
The following example demonstrates how to find an editable range by ID from a Word document.
// Load an existing Word document into the DocIO instance
WordDocument document = new WordDocument("Template.docx");
// Get the editable range by ID
EditableRange editableRange = document.EditableRanges FindById("0");
// Remove the editable range from the Word document
document.EditableRanges.Remove(editableRange);
// Save the document with the given name and format.
document.Save("Sample.docx", FormatType.Docx);
// Close the document and release resources
document.Close();
' Load an existing Word document into the DocIO instance
Dim document As New WordDocument("Template.docx")
' Get the editable range by ID
Dim editableRange As EditableRange = document.EditableRanges.FindById("0")
' Remove the editable range from the Word document
document.EditableRanges.Remove(editableRange)
' Save the document with the given name and format
document.Save("Sample.docx", FormatType.Docx)
' Close the document and release resources
document.Close()
Remove(EditableRange)
Removes the specified editable range from the document.
Declaration
public void Remove(EditableRange editableRange)
Parameters
Type | Name | Description |
---|---|---|
EditableRange | editableRange | The EditableRange to be removed. |
Examples
The following example illustrates how to remove an editable range from a Word document.
// Load an existing Word document into the DocIO instance
WordDocument document = new WordDocument("Template.docx");
// Get the editable range by ID
EditableRange editableRange = document.EditableRanges["0"];
// Remove the editable range from the Word document
document.EditableRanges.Remove(editableRange);
// Save the document with the given name and format.
document.Save("Sample.docx", FormatType.Docx);
// Close the document and release resources
document.Close();
' Load an existing Word document into the DocIO instance
Dim document As New WordDocument("Template.docx")
' Get the editable range by ID
Dim editableRange As EditableRange = document.EditableRanges("0")
' Remove the editable range from the Word document
document.EditableRanges.Remove(editableRange)
' Save the document with the given name and format
document.Save("Sample.docx", FormatType.Docx)
' Close the document and release resources
document.Close()
RemoveAt(Int32)
Removes an editable range at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The integer that represents the position of the editable range to remove. |
Examples
The following example illustrates how to remove an editable range from a specific index in a Word document.
// Load an existing Word document into the DocIO instance
WordDocument document = new WordDocument("Template.docx");
// Remove the editable range at the specified index
document.EditableRanges.RemoveAt(0);
// Save the document with the given name and format.
document.Save("Sample.docx", FormatType.Docx);
// Close the document and release resources
document.Close();
' Load an existing Word document into the DocIO instance
Dim document As New WordDocument("Template.docx")
' Remove the editable range at the specified index
document.EditableRanges.RemoveAt(0)
' Save the document with the given name and format
document.Save("Sample.docx", FormatType.Docx)
' Close the document and release resources
document.Close()