---
title: "Discussion on \"微信小程序wx.openDocument无法打开 doc,xls 文档，提示文件已损坏或未知文件格式\" | Hashnode"
description: "Discussion on \"微信小程序wx.openDocument无法打开 doc,xls 文档，提示文件已损坏或未知文件格式\". wx.openDocumenc 打开 doc 、xls 时，有时候会提示\"文件已损坏或未知文件格式\"。\n原因主要是文档的版本太久，微信不支持。建议采用兼容的方式处理，指定以 docx 的格式打开 doc,以 xlsx 的格式打开 xls。\n示例代码：\nlet fileExt = this.file.file_ext\nif (fileExt === 'doc' || fileExt === 'xls' || fileExt === 'ppt') {\n    fileExt += 'x'\n}\n\nwx..."
url: "https://hashnode.com/posts/wxopendocument-docxls/66598a3889eb3bdd521df6fc"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [微信小程序wx.openDocument无法打开 doc,xls 文档，提示文件已损坏或未知文件格式](https://blog.jayinton.com/wxopendocument-docxls?utm_source=hashnode&utm_medium=feed)

wx.openDocumenc 打开 doc 、xls 时，有时候会提示"文件已损坏或未知文件格式"。 原因主要是文档的版本太久，微信不支持。建议采用兼容的方式处理，指定以 docx 的格式打开 doc,以 xlsx 的格式打开 xls。 示例代码： let fileExt = this.file.file\_ext if (fileExt === 'doc' || fileExt === 'xls' || fileExt === 'ppt') { fileExt += 'x' } wx...

May 31, 2024 · 1 min read · blog.jayinton.com  
Read the article

-   [#iowrusoewwjeoiw6jw](https://hashnode.com/tag/iowrusoewwjeoiw6jw)

## Written by

[Jayin Taung](https://hashnode.com/@jayin)

@jayin · Guangzhou,China

  
[View profile](https://hashnode.com/@jayin)

拥抱变化，持续输出

PHPer,Creator of ZTBCMS

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
