We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

System.NotSupportedException: This stream does not support seek operations

hi, i am getting this error can any body tell me about this and solution

System.NotSupportedException: This stream does not support seek operations.
doc.MailMerge.MergeImageField += new Aspose.Words.Reporting.MergeImageFieldEventHandler(HandleMergeImageFieldFromDaatSet);
doc.MailMerge.MergeField += new Aspose.Words.Reporting.MergeFieldEventHandler(mailmergeEvent);


void mailmergeEvent(object sender, Aspose.Words.Reporting.MergeFieldEventArgs e)
    if (e.FieldName.ToString().ToLower() != "imagelink")
        if (string.IsNullOrEmpty(e.FieldValue.ToString()))
            Aspose.Words.Node parentRow = e.Field.Start.GetAncestor(NodeType.Row);
            if (parentRow != null)

i am getting error at doc.mailmerge.ExecuteWithRegions(ds.tables[0]);

Sorry for delay, there was weekend. I can’t reproduce your problem on my side. But I think it can occur in HandleMergeImageFieldFromDaatSet. Please try using the following code instead yours.

string url = e.FieldValue.ToString();
// Prepare the web page we will be asking for
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.ContentType = "application/msword";
request.UserAgent = "Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0";
// Execute the request
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
// We will read data via the response stream
Stream resStream = response.GetResponseStream();
// Write content into the MemoryStream 
BinaryReader resReader = new BinaryReader(resStream);
MemoryStream imgStream = new MemoryStream(resReader.ReadBytes((int)response.ContentLength));
Bitmap bmpmap = new Bitmap(imgStream);
// System.Drawing.Image image = System.Drawing.Image.FromStream(stream); 
DocumentBuilder builder = new DocumentBuilder(e.Document);
builder.InsertImage(bmpmap, 75, 100);

Hope this helps.
Best regards.