Hello,
I’m going to make this short as i’m having to type it two times.
The problem is with trying to get an image to load. I have been able to do it from a file using a file stream and loading into the ImageStream and it works fine.
The problem is that i am trying to get a value from a xml document that is encoded with a base64. I read the value out as a string, convert it to a byte array, and put it into a memory stream for the ImageStream.
I have tried passing it as the value as a string, char[] and byte[], but on the first two i get a “file cannot be found” type exception, and with the byte[] i get a not supported exception.
When i add an event handler to the image, and wrap up the base64 string into a memory stream, i get a “Parameter is not Valid” argument exception with no more error info, so i really am not sure what is going wrong there.
My handler looks like:
void MergeImageFiledHandler(object sender, Aspose.Words.Reporting.MergeImageFieldEventArgs e)
{
if (e.FieldValue != null)
{
e.ImageStream = new MemoryStream((byte[])e.FieldValue);
}
}
And fieldvalue is a byte[] that is served up by an xml reader that converts the string into a byte[].