ImageType

ImageType enumeration

指定 Microsoft Word 文档中图像的类型(格式)。

public enum ImageType

价值观

姓名价值描述
NoImage0没有图像数据。
Unknown1未知图像类型或无法直接存储在 Microsoft Word 文档中的图像类型。
Emf2Windows 增强型图元文件。
Wmf3Windows 图元文件.
Pict4Macintosh PICT。现有图像将保留在文档中,但不支持将新的 PICT 图像插入文档。
Jpeg5JPEG JFIF.
Png6便携式网络图形。
Bmp7Windows 位图.
Eps8封装的 PostScript。
WebP9WebP.
Gif10GIF

例子

展示如何读取 WebP 图像。

Document doc = new Document(MyDir + "Document with WebP image.docx");

Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
Assert.AreEqual(ImageType.WebP, shape.ImageData.ImageType);

展示如何向形状添加图像并检查其类型。

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape imgShape = builder.InsertImage(ImageDir + "Logo.jpg");
Assert.AreEqual(ImageType.Jpeg, imgShape.ImageData.ImageType);

也可以看看