DocumentBuilderInsertNode Method

Inserts a text level node inside the current paragraph before the cursor.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.7.0

Syntax

public void InsertNode(
	Node node
)

Parameters

node
Type: Aspose.WordsNode

Examples

Shows how to insert a linked image into a document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

string imageFileName = ImageDir + "Windows MetaFile.wmf";

builder.Write("Image linked, not stored in the document: ");

Shape shape = new Shape(builder.Document, ShapeType.Image);
shape.WrapType = WrapType.Inline;
shape.ImageData.SourceFullName = imageFileName;

builder.InsertNode(shape);
builder.Writeln();

builder.Write("Image linked and stored in the document: ");

shape = new Shape(builder.Document, ShapeType.Image);
shape.WrapType = WrapType.Inline;
shape.ImageData.SourceFullName = imageFileName;
shape.ImageData.SetImage(imageFileName);

builder.InsertNode(shape);
builder.Writeln();

builder.Write("Image stored in the document, but not linked: ");

shape = new Shape(builder.Document, ShapeType.Image);
shape.WrapType = WrapType.Inline;
shape.ImageData.SetImage(imageFileName);

builder.InsertNode(shape);
builder.Writeln();

doc.Save(ArtifactsDir + "Image.CreateLinkedImage.docx");

See Also