EditableRangeStart Class
Represents the starting position of an EditableRange within the word document.
Inheritance
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Base.dll
Syntax
public class EditableRangeStart : ParagraphItem, IXDLSSerializable, IWidget, IParagraphItem, IEntity, IOfficeRun
Constructors
EditableRangeStart(IWordDocument)
Initializes a new instance of the EditableRangeStart class with the specified IWordDocument instance.
Declaration
public EditableRangeStart(IWordDocument doc)
Parameters
Type | Name | Description |
---|---|---|
IWordDocument | doc |
Examples
The following example illustrates how to add an editable range to a paragraph:
// Create a new WordDocument instance and ensure it has minimal content.
IWordDocument document = new WordDocument();
document.EnsureMinimal();
document.LastParagraph.AppendText(@"Adventure Works Cycles, the fictitious company on which the AdventureWorks ");
// Add an editable range to the paragraph.
EditableRangeStart rangeStart = new EditableRangeStart(document);
document.LastParagraph.ChildEntities.Add(rangeStart);
document.LastParagraph.AppendText(@"sample databases are based, is a large, multinational manufacturing company.");
EditableRangeEnd rangeEnd = new EditableRangeEnd(document);
document.LastParagraph.ChildEntities.Add(rangeEnd);
// Sets the protection with password and allows only reading.
document.Protect(ProtectionType.AllowOnlyReading, "password");
// Save and close the document.
document.Save("EditableRange.docx", FormatType.Docx);
document.Close();
' Create a new WordDocument instance and ensure it has minimal content.
Dim document As IWordDocument = New WordDocument()
document.EnsureMinimal()
document.LastParagraph.AppendText("Adventure Works Cycles, the fictitious company on which the AdventureWorks ")
' Add an editable range to the paragraph.
Dim rangeStart As New EditableRangeStart(document)
document.LastParagraph.ChildEntities.Add(rangeStart)
document.LastParagraph.AppendText("sample databases are based, is a large, multinational manufacturing company.")
Dim rangeEnd As New EditableRangeEnd(document)
document.LastParagraph.ChildEntities.Add(rangeEnd)
' Sets the protection with password and allows only reading.
document.Protect(ProtectionType.AllowOnlyReading, "password")
' Save and close the document.
document.Save("EditableRange.docx", FormatType.Docx)
document.Close()
Properties
EditorGroup
Gets or sets the editor group for editor groups.
Declaration
public EditorType EditorGroup { get; set; }
Property Value
Type | Description |
---|---|
EditorType | The EditorType member that specifies the type of editor group. |
Examples
The following example illustrates how to set the EditorGroup
for an editable range in a paragraph:
// Create a new WordDocument instance and ensure it has minimal content.
WordDocument document = new WordDocument();
document.EnsureMinimal();
document.LastParagraph.AppendText(@"Adventure Works Cycles, the fictitious company on which the AdventureWorks ");
// Add an editable range to the paragraph.
EditableRangeStart rangeStart = document.LastParagraph.AppendEditableRangeStart();
// Set the editor group.
rangeStart.EditorGroup = EditorType.Everyone;
document.LastParagraph.AppendText(@"sample databases are based, is a large, multinational manufacturing company.");
EditableRangeEnd rangeEnd = document.LastParagraph.AppendEditableRangeEnd(rangeStart);
// Sets the protection with password and allows only reading.
document.Protect(ProtectionType.AllowOnlyReading, "password");
// Save and close the document.
document.Save("EditableRange.docx", FormatType.Docx);
document.Close();
' Create a new WordDocument instance and ensure it has minimal content.
Dim document As New WordDocument()
document.EnsureMinimal()
document.LastParagraph.AppendText("Adventure Works Cycles, the fictitious company on which the AdventureWorks ")
' Add an editable range to the paragraph.
Dim rangeStart As EditableRangeStart = document.LastParagraph.AppendEditableRangeStart()
' Set the editor group.
rangeStart.EditorGroup = EditorType.Everyone
document.LastParagraph.AppendText("sample databases are based, is a large, multinational manufacturing company.")
Dim rangeEnd As EditableRangeEnd = document.LastParagraph.AppendEditableRangeEnd(rangeStart)
' Sets the protection with password and allows only reading.
document.Protect(ProtectionType.AllowOnlyReading, "password")
' Save and close the document.
document.Save("EditableRange.docx", FormatType.Docx)
document.Close()
EntityType
Gets the type of the entity.
Declaration
public override EntityType EntityType { get; }
Property Value
Type | Description |
---|---|
EntityType | The EntityType of the current item. |
Overrides
FirstColumn
Gets or sets the column index where the editable range starts within the table. Default value is -1.
Declaration
public short FirstColumn { get; set; }
Property Value
Type |
---|
System.Int16 |
Remarks
This property is valid for selecting table cells only when the corresponding editable range ends in the same row or in the following rows of the same table.
This property defines the top-left corner cell of a rectangular selection region, as editable ranges in tables are restricted to rectangular areas.
If the value is negative, greater than the number of cells in a row, or greater than the LastColumn
value, the selection starts from the first cell of the respective row.
Examples
The following example demonstrates how to define an editable range that starts at a specific column in a table:
// Create a word document and add a table
WordDocument document = new WordDocument();
document.AddSection();
WTable table = document.LastSection.AddTable() as WTable;
table.ResetCells(2, 3);
// Add text and start the editable range at column 1
table[0, 1].AddParagraph().AppendText("Editable content");
EditableRangeStart rangeStart = table[0, 1].Paragraphs[0].AppendEditableRangeStart();
rangeStart.FirstColumn = 1;
// Add content inside the editable range
table[1, 2].AddParagraph().AppendText("Editable Content");
// End the editable range at column 2
EditableRangeEnd rangeEnd = table[1, 2].Paragraphs[0].AppendEditableRangeEnd();
rangeStart.LastColumn = 2;
// Protect the document with read-only access
document.Protect(ProtectionType.AllowOnlyReading, "password");
// Save and close the document
document.Save("EditableRange.docx", FormatType.Docx);
document.Close();
' Create a word document and add a table
Dim document As New WordDocument()
document.AddSection()
Dim table As WTable = TryCast(document.LastSection.AddTable(), WTable)
table.ResetCells(2, 3)
' Add text and start the editable range at column 1
table(0, 1).AddParagraph().AppendText("Editable content")
Dim rangeStart As EditableRangeStart = table(0, 1).Paragraphs(0).AppendEditableRangeStart()
rangeStart.FirstColumn = 1
' Add content inside the editable range
table(1, 2).AddParagraph().AppendText("Editable Content")
' End the editable range at column 2
Dim rangeEnd As EditableRangeEnd = table(1, 2).Paragraphs(0).AppendEditableRangeEnd()
rangeStart.LastColumn = 2
' Protect the document with read-only access
document.Protect(ProtectionType.AllowOnlyReading, "password")
' Save and close the document
document.Save("EditableRange.docx", FormatType.Docx)
document.Close()
Id
Gets the id of editable range start.
Declaration
public string Id { get; }
Property Value
Type | Description |
---|---|
System.String | The string that represents the id of editable range start. |
LastColumn
Gets or sets the column index where the editable range ends within the table. Default value is -1.
Declaration
public short LastColumn { get; set; }
Property Value
Type |
---|
System.Int16 |
Remarks
This property is applicable when selecting table cells using editable ranges. It defines the bottom-right corner cell of the rectangular selection region within the table.
The corresponding editable range start must be in the same row or a row before the current one within the same table.
If the value is negative, greater than the number of cells in a row, or less than the FirstColumn
value, the range will automatically extend to the last cell of the respective row.
Examples
The following example demonstrates how to define an editable range that starts at a specific column in a table:
// Create a word document and add a table
WordDocument document = new WordDocument();
document.AddSection();
WTable table = document.LastSection.AddTable() as WTable;
table.ResetCells(2, 3);
// Add text and start the editable range at column 1
table[0, 1].AddParagraph().AppendText("Editable content");
EditableRangeStart rangeStart = table[0, 1].Paragraphs[0].AppendEditableRangeStart();
rangeStart.FirstColumn = 1;
// Add content inside the editable range
table[1, 2].AddParagraph().AppendText("Editable Content");
// End the editable range at column 2
EditableRangeEnd rangeEnd = table[1, 2].Paragraphs[0].AppendEditableRangeEnd();
rangeStart.LastColumn = 2;
// Protect the document with read-only access
document.Protect(ProtectionType.AllowOnlyReading, "password");
// Save and close the document
document.Save("EditableRange.docx", FormatType.Docx);
document.Close();
' Create a word document and add a table
Dim document As New WordDocument()
document.AddSection()
Dim table As WTable = TryCast(document.LastSection.AddTable(), WTable)
table.ResetCells(2, 3)
' Add text and start the editable range at column 1
table(0, 1).AddParagraph().AppendText("Editable content")
Dim rangeStart As EditableRangeStart = table(0, 1).Paragraphs(0).AppendEditableRangeStart()
rangeStart.FirstColumn = 1
' Add content inside the editable range
table(1, 2).AddParagraph().AppendText("Editable Content")
' End the editable range at column 2
Dim rangeEnd As EditableRangeEnd = table(1, 2).Paragraphs(0).AppendEditableRangeEnd()
rangeStart.LastColumn = 2
' Protect the document with read-only access
document.Protect(ProtectionType.AllowOnlyReading, "password")
' Save and close the document
document.Save("EditableRange.docx", FormatType.Docx)
document.Close()
SingleUser
Declaration
public string SingleUser { get; set; }
Property Value
Type |
---|
System.String |
Methods
CloneImpl()
Creates a duplicate copy of the entity.
Declaration
protected override object CloneImpl()
Returns
Type | Description |
---|---|
System.Object | An object that is newly created. |
Overrides
CreateLayoutInfo()
Creates layout information for EditableRangeStart
Declaration
protected override void CreateLayoutInfo()