public string CreateImageUri(string rootUri, OfficeImage image, string relativeUri) { string imageName = String.Format("image{0}", _imageId); _imageId++; OfficeImageFormat imageFormat = GetActualImageFormat(image.RawFormat); Stream stream = new MemoryStream(image.GetImageBytes(imageFormat)); string mediaContentType = OfficeImage.GetContentType(imageFormat); LinkedAttachementInfo info = new LinkedAttachementInfo(stream, mediaContentType, imageName); _attachments.Add(info); return("cid:" + imageName); }
public string CreateImageUri(string rootUri, OfficeImage image, string relativeUri) { string imageName = string.Format("image{0}", imageId); imageId++; OfficeImageFormat imageFormat = GetActualImageFormat(image.RawFormat); byte[] data = image.GetImageBytes(imageFormat); string mediaContentType = OfficeImage.GetContentType(imageFormat); AttachementInfo info = new AttachementInfo() { Data = data, MimeType = mediaContentType, ContentId = imageName }; this.Attachments.Add(info); return("cid:" + imageName); }