We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to display a image into TextArea VB using Aspose.Word

Page load will retrieve the filePath from database, resize image if too large, display it in the TextArea in a webpage


Thanks for your inquiry. Please check following code snippet to add image in a TextBox shape. Please note FitShapetoText property resizes image as per TextBox dimensions. Hopefully it will help you to accomplish the task.

Dim doc As New Document()
Dim builder As New DocumentBuilder(doc)

Dim imagepath As [String] = "D:/Downloads/Adobe_font.png"
Dim img As Image = Image.FromFile(imagepath)
Dim width As [Double] = ConvertUtil.PixelToPoint(img.Width, img.HorizontalResolution)
Dim height As [Double] = ConvertUtil.PixelToPoint(img.Height, img.VerticalResolution)

Dim textbox As New Shape(doc, ShapeType.TextBox)
textbox.TextBox.FitShapeToText = True
textbox.Width = (width + (textbox.TextBox.InternalMarginLeft + textbox.TextBox.InternalMarginRight))
textbox.Height = (height + (textbox.TextBox.InternalMarginTop + textbox.TextBox.InternalMarginBottom))
textbox.WrapType = WrapType.Inline
textbox.Stroked = False
textbox.AppendChild(New Paragraph(doc))



My images are store at a remote server. My web page read the file path from database and display them in a gridview in VB.
Is it possible?



Thanks for your feedback. Aspose.Words can read the files and streams those are accessible in your application. So in your scenario Aspose.Words will read the image files. However, if you face any issue then please share the details here, we will look into it and will guide you accordingly.

Can you send me example?


Please use the code from this post to insert image inside TextBox in Word document.

If that is not what you are asking about, then please share complete details of your usecase.