Returns true if this shape is an image shape.
[Visual Basic]Public ReadOnly Property IsImage As
Boolean [C#]public
bool IsImage {get;}
Example
Opens an HTML document with images from a stream with a base URI.
[C#]
// We are opening this HTML file:
/*
<html>
<body>
<p>Simple file.</p>
<p><img src="Aspose.Words.gif" width="80" height="60"></p>
</body>
</html>
*/
string fileName = MyDir + "Document.OpenFromStreamWithBaseUri.html";
// Open the stream.
Stream stream = File.OpenRead(fileName);
// Open the document. Note the Document constructor detects HTML format automatically.
// Pass the URI of the base folder so any images with relative URIs in the file can be found.
Document doc = new Document(stream, MyDir);
// You can close the stream now, it is no longer needed because the document is in memory.
stream.Close();
// Lets make sure the image was imported successfully into a Shape node.
// Get the 1st shape node in the document.
Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
// Verify some properties of the image.
Assert.IsTrue(shape.IsImage);
Assert.IsNotNull(shape.ImageData.ImageBytes);
Assert.AreEqual(80.0, ConvertUtil.PointToPixel(shape.Width));
Assert.AreEqual(60.0, ConvertUtil.PointToPixel(shape.Height));
// Save in the DOC format.
doc.Save(MyDir + "Document.OpenFromStreamWithBaseUri Out.doc");[Visual Basic]
' We are opening this HTML file:
'
'<html>
'<body>
'<p>Simple file.</p>
'<p><img src="Aspose.Words.gif" width="80" height="60"></p>
'</body>
'</html>
'
Dim fileName As String = MyDir & "Document.OpenFromStreamWithBaseUri.html"
' Open the stream.
Dim stream As Stream = File.OpenRead(fileName)
' Open the document. Note the Document constructor detects HTML format automatically.
' Pass the URI of the base folder so any images with relative URIs in the file can be found.
Dim doc As Document = New Document(stream, MyDir)
' You can close the stream now, it is no longer needed because the document is in memory.
stream.Close()
' Lets make sure the image was imported successfully into a Shape node.
' Get the 1st shape node in the document.
Dim shape As Shape = CType(doc.GetChild(NodeType.Shape, 0, True), Shape)
' Verify some properties of the image.
Assert.IsTrue(shape.IsImage)
Assert.IsNotNull(shape.ImageData.ImageBytes)
Assert.AreEqual(80.0, ConvertUtil.PointToPixel(shape.Width))
Assert.AreEqual(60.0, ConvertUtil.PointToPixel(shape.Height))
' Save in the DOC format.
doc.Save(MyDir & "Document.OpenFromStreamWithBaseUri Out.doc")See Also
ShapeBase Class | Aspose.Words.Drawing Namespace