'''' This code is part of Document Solutions for Word demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystemImportsSystem.IOImportsGrapeCity.Documents.WordImportsGrapeCity.Documents.Imaging '' This sample demonstrates how to add a JPEG image to a document.PublicClassPictureAddFunctionCreateDocx() AsGcWordDocumentDim doc = NewGcWordDocument() '' Load picture dataDim picBytes = File.ReadAllBytes(Path.Combine("Resources", "Images", "road.jpg"))'' Create a GcBitmap so that we can find out the native picture sizeDim image = NewGcBitmap(picBytes)Dim width = doc.Body.Sections.Last.PageSetup.ClientWidthDim height = image.Height * (width / image.Width) '' Add an inline picture that fills the page widthDim pars = doc.Body.Sections.First.GetRange().ParagraphsDim par = pars.Add("Picture sized to fill the page:")Dim Run = par.GetRange().Runs.Last Run.GetRange().Texts.AddBreak()'' Add picture, specifying its mime typeDim pic = Run.GetRange().Pictures.Add(picBytes, "image/jpeg")'' Scale picture size to fill the width of the page pic.Size.Width.Value = width pic.Size.Height.Value = height pars.Add("The End.") '' DoneReturn docEndFunctionEndClass