'''' This code is part of Document Solutions for Word demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystemImportsSystem.IOImportsGrapeCity.Documents.Word '' This sample loads an existing document, And replaces'' the (only) image in it with a different one.PublicClassReplaceImagePublicFunctionCreateDocx() AsGcWordDocument'' The New image dataDim picBytes = File.ReadAllBytes(Path.Combine("Resources", "ImagesBis", "DianeForsyth.jpg")) '' Load the documentDim doc = NewGcWordDocument() doc.Load(Path.Combine("Resources", "WordDocs", "ProcurementLetter.docx")) '' Access the image to replaceDim pic = doc.Body.Sections.First.GetRange().Pictures.First'' Replace the image data in place: pic.ImageData.SetImage(picBytes, "image/jpeg") '' DoneReturn docEndFunctionEndClass