1 使用详解
(1)InsertImage()
说明:在当前位置插入图片。
格式:
(1)public Shape InsertImage(string fileName);
(2)public Shape InsertImage(Image image);
(3)public Shape InsertImage(string fileName, double width, double height);
(4)public Shape InsertImage(Image image, double width, double height);
(2)FromFile()
说明:通过指定路径获取图片对象。
格式:public static Image FromFile(string filename);
2 插入图片并设置默认宽高
实现代码:
Document doc=new Document("test.doc");
DocumentBuilder builder =new DocumentBuiler();
string imageUrl="c:/1.jpg";
if (File.Exists(imageUrl)){
//第一种方式
builder.InsertImage(imageUrl);
//第二种方式
Image image = Image.FromFile(imageUrl);
builder.InsertImage(image);
}