delete method

delete()

Deletes all characters of the range.

def delete(self):
    ...

Examples

Shows how to delete all the nodes from a range.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

# Add text to the first section in the document, and then add another section.
builder.write("Section 1. ")
builder.insert_break(aw.BreakType.SECTION_BREAK_CONTINUOUS)
builder.write("Section 2.")

self.assertEqual("Section 1. \fSection 2.", doc.get_text().strip())

# Remove the first section entirely by removing all the nodes
# within its range, including the section itself.
doc.sections[0].range.delete()

self.assertEqual(1, doc.sections.count)
self.assertEqual("Section 2.", doc.get_text().strip())

See Also