spring boot rest download docx

huangapple go评论113阅读模式
英文:

spring boot rest download docx

问题

I'm sorry, but it seems like the content you provided contains code and symbols that cannot be translated. If you have any specific questions or need assistance with a particular part of the code, please let me know, and I'll be happy to help.

英文:

I'm trying to download docx file but encoding goes wrong

@GetMapping(value = ["/get-file"], produces = [MediaType.APPLICATION_OCTET_STREAM_VALUE])
@ResponseBody
@Throws(IOException::class)
fun getFile(): ByteArray {
    val file = File("somePath\\data.docx")
    val fis = FileInputStream(file)
    return IOUtils.toByteArray(fis)
}

what can i do with this?

> PKEi#P[Content_Types].xmlŖ�N�0E%�5. !����$��ֵ'���=���L�6B�i �b9��s��I���5�+���+�q>d8�v��=Mn�,�(��;(���r<�|T3��b����Q�����
)�V ݆��|3�'����!8]��G�P����}^�.��*��@��N�, �L�s]�#2��杪��!52�G�������Ӿ��Gh�,����Ҕ\.&quot;z�l�C c@
K��NX*�;��6���� P�L�T� dn�9��S��h��W
m<�j�|P�+!Fjbk�N�B�o��w��t�ㆭhVjR��jM���f�NN A� }�v���E��?�&��҈��bB�mB��m���i�`w~�&p ;�@����""�zq��E���&��!�~�z����^�v�L����
�7?|�OPK�<�.

答案1

得分: 0

docx 的媒体类型是:

application/vnd.openxmlformats-officedocument.wordprocessingml.document
英文:

The media type of docx is:

application/vnd.openxmlformats-officedocument.wordprocessingml.document

huangapple
  • 本文由 发表于 2020年1月3日 19:18:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/59577675.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定