weixin_41325924
weixin_41325924
2018-08-09 04:04

急!!!大神帮帮忙!!asp.netWord加水印用Spire.Doc后代码报错

40
  • 文档
  • 图片
  • 2010

PictureWatermark picture = new PictureWatermark();
picture.Picture = System.Drawing.Image.FromFile(Server.MapPath("/skin/images/water.png"));这句代码里面报错了,附上图片
图片说明
下面是我的程序:
string setimg = Server.MapPath("/skin/images/water.png");
Response.Write(setimg);
Document document = new Document();
document.LoadFromFile(Server.MapPath("/UploadFile/DescriptionWE/" + setname));
//新建一个图片水印对象并添加为待设置水印的图片
PictureWatermark picture = new PictureWatermark();
picture.Picture = System.Drawing.Image.FromFile("F://0808/SDWeb/SDWeb/skin/images/water.png ");
//根据需要设置图片的大小,将其设置为文档的水印
picture.Scaling = 90;
document.Watermark = picture;
//保存文档
document.SaveToFile(Server.MapPath("~/UploadFile/DescriptionWE/") + PFDname, FileFormat.Docx2010);

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

5条回答