VegaRise.NET
Back to VDocs

InsertBeforeMethod

Definition

Namespace
DOM
Assembly
VDocs.dll

Overloads

InsertBefore(IElement sourceElement, IElement[] elementsToInsert)

Inserts elements before the specified source element.

InsertBefore(IElement[] elementsToInsert)

Inserts one or more elements before the first child of the document.

InsertBefore(IElement sourceElement, IElement[] elementsToInsert)

InsertBefore(IElement sourceElement, IElement[] elementsToInsert)

Inserts elements before the specified source element.

Parameters

sourceElement
The element before which new elements will be inserted.
elementsToInsert
The elements to insert.

Remarks

This method inserts the specified elements immediately before the source element within the same parent collection.

InsertBefore(IElement[] elementsToInsert)

InsertBefore(IElement[] elementsToInsert)

Inserts one or more elements before the first child of the document.

Parameters

elementsToInsert
The elements to insert.

Remarks

If the document already has child elements, the new elements are inserted before the first child. Otherwise, the elements are added as new children. This is a convenience method that simplifies prepending elements to the beginning of the document.

Examples

csharp
1var doc = new VDocs("report.docx");
2
3// Prepend content at the beginning
4var newParagraph = new Paragraph();
5newParagraph.AddText("New introductory paragraph");
6doc.InsertBefore(newParagraph);
7
VegaRise.NET

Sign In

Welcome back. Please sign in to your account.

Forgot password?
or

Don't have an account? Create an account

By signing in, you agree to our Terms of Service and Privacy Policy.