原创

C#-Aspose.Words-解决插入图片不能百分百显示图片大下-图片原始大下-100%-图片缩放-图片变大-图片模糊-设置图片宽高无效

string filePath = GetQRCode(QRUrl, "Byte", "L", 1, titleName);//返回生成二维码的路径
shape.ImageData.SetImage(filePath);


ImageSize size = shape.ImageData.ImageSize;
//ImageSize 类属性
//public int HeightPixels { get; }
//public double HeightPoints { get; }
//public double HorizontalResolution { get; }
//public double VerticalResolution { get; }
//public int WidthPixels { get; }
//public double WidthPoints { get; }**

double originWidth = size.WidthPoints;
double originHeight = size.HeightPoints;
//核心 20171130 js 修改 图片的大小和手动设置的大小不是一回事!!!
shape.Width = originWidth;
shape.Height = originHeight;



shape.WrapType = WrapType.None;
shape.BehindText = true;

entbuilder.MoveToBookmark("PO_ErWeiMa");
entbuilder.InsertNode(shape);

// 或者使用 entbuilder.InsertImage(filePath, RelativeHorizontalPosition.Margin, 0, RelativeVerticalPosition.Margin, 0, originWidth, originHeight, WrapType.None);
// (RelativeHorizontalPosition.Margin 可以换成RelativeHorizontalPosition.Page等,就是相对于页面边界)

正文到此结束
本文目录