Word 2003 supports an xml output for documents that uses Base64 to
encode the embedded images. Im looking to grab that image out of the
xml and write it to a file. Im able to parse the xml and isolate the
Base64 string but decoding it out to a file hasn't been working for me;
the image doesn't come back looking correct. Stripped down version of
the code assuming 'AaBaCc' represents the really long Base64 encoded GIF
image string:
Assuming you're on Windows, you'll probably want "wb" rather than just
"w" for the file mode. Also, I'd do this:
File.open("/test.gif", "wb") do |file|
file << Base64.decode64(str)
end
to make sure the file gets closed.
···
On Sun, 2006-06-04 at 21:25 +0900, Aaron Worsham wrote:
Word 2003 supports an xml output for documents that uses Base64 to
encode the embedded images. Im looking to grab that image out of the
xml and write it to a file. Im able to parse the xml and isolate the
Base64 string but decoding it out to a file hasn't been working for me;
the image doesn't come back looking correct. Stripped down version of
the code assuming 'AaBaCc' represents the really long Base64 encoded GIF
image string:
On 6/4/06, Aaron Worsham <aaronw@dynalinkweb.com> wrote:
Word 2003 supports an xml output for documents that uses Base64 to
encode the embedded images. Im looking to grab that image out of the
xml and write it to a file. Im able to parse the xml and isolate the
Base64 string but decoding it out to a file hasn't been working for me;
the image doesn't come back looking correct. Stripped down version of
the code assuming 'AaBaCc' represents the really long Base64 encoded GIF
image string: