Overloads
InsertAfter(IElement sourceElement, IElement[] elementsToInsert)
Inserts elements after the specified source element.
InsertAfter(IElement[] elementsToInsert)
Inserts one or more elements after the last child of the document.
InsertAfter(IElement sourceElement, IElement[] elementsToInsert)
InsertAfter(IElement sourceElement, IElement[] elementsToInsert)Inserts elements after the specified source element.
Parameters
- sourceElement
- The element after which new elements will be inserted.
- elementsToInsert
- The elements to insert.
Remarks
This method inserts the specified elements immediately after the source element within the same parent collection.
InsertAfter(IElement[] elementsToInsert)
InsertAfter(IElement[] elementsToInsert)Inserts one or more elements after the last child of the document.
Parameters
- elementsToInsert
- The elements to insert.
Remarks
If the document already has child elements, the new elements are inserted after the last child. Otherwise, the elements are added as new children. This is a convenience method that simplifies appending elements to the end of the document.
Examples
csharp
1var doc = new VDocs("report.docx");
2
3// Append content at the end
4var newParagraph = new Paragraph();
5newParagraph.AddText("Appended content");
6doc.InsertAfter(newParagraph);
7