我一直在使用此代码从 word 文件中提取图像:
Document doc = new Document(MyDir + "Image.SampleImages.doc");
NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true, false);
int imageIndex = 0;
foreach (Shape shape in shapes)
{
if (shape.HasImage)
{
string imageFileName = string.Format(
"Image.ExportImages.{0} Out{1}", imageIndex, FileFormatUtil.ImageTypeToExtension(shape.ImageData.ImageType));
shape.ImageData.Save(MyDir + imageFileName);
imageIndex++;
}
}
图像的输出格式是 .emf 而我想要它 .png。请告诉我如何使用上面的代码来获取“PNG”格式而不是 EMF。