This project has moved and is read-only. For the latest updates, please go here.

Bug in DocX.AddImage...

Aug 13, 2009 at 1:10 PM

Hi, thanks for this great tool :)

However there is a bug that is causing me some problems.

In AddImage(object o) there is a call to IsSameFile(), this function closes the input streams after comparison so the input stream will be closed giving an ObjectDisposedException later (when trying to read from the input stream).

This happens if I add two (or more) images from a stream to the same document (it works for the first picture because the IsSameFile function is not called then).

Also, you should consider using the FileAccess.Read parameter when opening files as streams (for reading) to avoid some potential locked file exceptions.

Hope this is useful, thanks again...

Trond K.
Aug 13, 2009 at 3:27 PM
Hi trnilse,

thank you for taking the time to report this issue. I have just rewritten this function for the next release to incorporate your fix.

thanks again,
Aug 13, 2009 at 10:24 PM


Cool, that's great! Any plan for when this will be released?

(If it is a little in the future, could you possible upload the source for so I could make a temporrary fix for myself?)



Trond K.

Aug 14, 2009 at 9:04 AM

Unfortunately I can't upload the source for because I have mistakenly added to it for's release and it is still buggy. If you send me your email address, I will zip up the source for and send it to you?

sorry for the inconvenience,
Aug 14, 2009 at 2:56 PM


Aha, so that's why there is no source :)  In that case I can wait for



Trond K.