0
点赞
收藏
分享

微信扫一扫

TCGA从整理到画生存分析

科牛 2024-11-07 阅读 18

1 添加依赖

Spire.Xls.jar

        <dependency>
            <groupId>e-iceblue</groupId>
            <artifactId>spire.xls</artifactId>
            <version>5.3.3</version>
        </dependency>

2 代码使用

package cctd.controller;

import com.spire.xls.FileFormat;
import com.spire.xls.Workbook;

import java.io.*;

public class MainServer {
    public static void main(String[] args) {
        //加载xml文件或 Office OpenXml 类型的xsl文件
        Workbook wb = new Workbook();
        File file = new File("C:\\Users\\17240\\Downloads\\1.xml");
        //将File转为inputstream流
        InputStream is = null;
        try {
            is = new FileInputStream(file);
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
        wb.loadFromXml(is);
        //转为2013版xlsx格式的Excel
        wb.saveToFile("C:\\Users\\17240\\Downloads\\2.xlsx", FileFormat.Version2013);
    }
}


3 实现效果

在这里插入图片描述

举报

相关推荐

0 条评论