word 另存为xml后,读取xml的图片数据
生活随笔
收集整理的這篇文章主要介紹了
word 另存为xml后,读取xml的图片数据
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
我們把word文檔另存為xml后。圖片數(shù)據(jù)是使用base64編碼存儲的,這樣我們就可以使用base64對數(shù)據(jù)進行解碼。
把圖片讀取出來。
代碼如下:
?
代碼 ?private?void?button1_Click(object?sender,?EventArgs?e)????????{
????????????byte[]?ary?=?Convert.FromBase64String(textBox1.Text);
????????????Image?img?=?BytesToImage(ary);
????????????pictureBox1.Image?=?img;
????????}
????????public?static?Image?BytesToImage(byte[]?bytes)
????????{
????????????MemoryStream?ms?=?new?MemoryStream(bytes);
????????????Image?rtnImg?=?Image.FromStream(ms);
????????????return?rtnImg;
????????}
?
?
文本框中的數(shù)據(jù)是word的圖片經(jīng)過base64編碼的數(shù)據(jù)。
?
轉(zhuǎn)載于:https://www.cnblogs.com/yg_zhang/archive/2010/08/24/1806947.html
總結(jié)
以上是生活随笔為你收集整理的word 另存为xml后,读取xml的图片数据的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: InstallShield 2011新功
- 下一篇: sql2005收集作业相关历史记录