V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
ccw123456
V2EX  ›  问与答

Java POI 导出 excel 打开文件提示文件格式或扩展名无效,应该是编码问题但一直找不到解决方法,求大神指导下!

  •  
  •   ccw123456 · Oct 5, 2022 · 1721 views
    This topic created in 1310 days ago, the information mentioned may be changed or developed.

    https://tvax2.sinaimg.cn/large/6cff1f3fly1h6uhu8kvpuj20lf0ewwvc.jpg 这是不能打开 excle 文件,默认编码是 utf-8

    https://tva4.sinaimg.cn/large/6cff1f3fly1h6uhwcsyxrj20sr0czkbb.jpg 这是可以打开 excle 文件,默认编码是 ansi

    代码没问题,ruoyi 直接拉下来的,可能是 idea 配置或 jdk 的问题,但也都试过,依旧不行,

    3 replies    2022-10-05 22:14:49 +08:00
    arch9999
        1
    arch9999  
       Oct 5, 2022
    utf-8-sig (utf-8 with BOM)呢?
    ccw123456
        2
    ccw123456  
    OP
       Oct 5, 2022
    @arch9999 试过了
    undeflife
        3
    undeflife  
       Oct 5, 2022
    xlsx 格式是个 zip 包
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3377 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 12:32 · PVG 20:32 · LAX 05:32 · JFK 08:32
    ♥ Do have faith in what you're doing.