Link to home
Start Free TrialLog in
Avatar of chilekitty
chilekitty

asked on

Programmatically insert images from xml into Word 2003

I am pretty new to vb.net so please bare with my newness...
What I need to do is read xml files that are provided to me.  For each base64 image I find, I will decode and insert them programmatically into a Word document.  I have accomplished this in my older vb6  application but we are now updating all our applications to .net and am having some issues.  
So now, in .net, I decode [Convert.FromBase64String(xmlStr)] my base64 image into a byte array and.....what?? From here how do I add the image to my bookmark in my document?  In vb6 I was saving the decoded image to a file and then inserting the image - will I need to do this still?? or is there a way to do this without saving anything out to a file.  I have been looking and looking but have not been able to find any examples (I could be wording my inquiries wrong??) that will insert a decoded image without saving it to file first.  
Please let me know if you need any further information or if I need to clarify anything.  And many thanks in advance for any info!!
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Ah, yes, so many doors to check, so little time!! *WINK*

Here is a previous question that shows a class that I have in my bag-o-tricks:

https://www.experts-exchange.com/questions/22738049/Convert-MemoryStream-to-Byte-Array.html
Avatar of chilekitty
chilekitty

ASKER

Thanks for your quick response!!!  I was fortunate to have run into your class and have tried it and it works great.  But sorry to say, I am still stuck on the issue of what do I need to do now that I have this image.......I mean how do I now insert it into my Word document based on a bookmark?  
There are only so many ways to insert an image into word and I have not been able to find an example that does not require a filename or a copy to the clipboard both of which were a thumbs down per boss.  I feel like I'm missing something here....??  
So really the bottom line issue is how can I insert an image into Word (per bookmark) once I have the image in memory?  Any help would be greatly appreciated!

That, my friend, is a great question.  I haven't found a way, yet, to insert an Image into Word without an intermediate file, but that doesn't mean that is impossible.  
I like the way you worded it....."yet".  I have hope.  Once again...much thanks for your help!

Hopefully someone may come across this question and have some insight into this dilemma.  
If I have learned anything over these past 20+ years, is that nothing is impossible, just undiscovered.
Would something commercial, like Aspose.Words, be an option?  I am not sure of its capabilities for your particular problem, but they have a free trial that you can download and test.

Aspose.Words for .NET and Java
http://www.aspose.com/categories/file-format-components/aspose.words-for-.net-and-java/default.aspx
ASKER CERTIFIED SOLUTION
Avatar of chilekitty
chilekitty

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial