private string AddGraph(WordprocessingDocument wpd, string filepath)
{
ImagePart ip = wpd.MainDocumentPart.AddImagePart(ImagePartType.Jpeg);
using (FileStream fs = new FileStream(filepath, FileMode.Open))
{
if (fs.Length == 0) return string.Empty;
ip.FeedData(fs);
}
return wpd.MainDocumentPart.GetIdOfPart(ip);
}
In this case we use a FileStream to retrieve the image, but feedData(Stream) is waiting for any kind of Stream.