将字节数组转换为文件(Word,Excel,PPT ..) [英] Convert Byte Array to File (Word, Excel, PPT..)

查看:960
本文介绍了将字节数组转换为文件(Word,Excel,PPT ..)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



我正在调用一个webservice,它正在向我发送我在webmethod中作为参数发送的文件的bytearray。



我想将这个字节数组转换为具有相同扩展名和类型的文件,我在网络方法中发送它: -





Service.GetDocument(Testing.docx)





现在,从Web服务返回的字节数组应该只转换为docs文件,只能使用相同的名称(Testing)进入我的本地计算机。



我是无法编写将其转换为文件并将其保存在我的本地计算机上的代码



谢谢



Varun Sareen

Dear Friends,

I am calling a webservice which is sending me the bytearray of the file which i am sending as the parameter in the webmethod.

I want to convert this byte array into the file with same extension and type which i am sending in the webmethod like:-


Service.GetDocument("Testing.docx")


Now here the byte array returned from the web service should get converted into docs file only with the same name (Testing) into my local computer.

I am not able to write the code of converting it into the File and saving it on my local computer

Thanks

Varun Sareen

推荐答案



Hi,
File.WriteAllBytes(string path, byte[] bytes)



希望其帮帮你。



祝你好运


Hope its Help u.

Best luck


这篇关于将字节数组转换为文件(Word,Excel,PPT ..)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆