0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Java XMLを Excelに変換

Posted at

XMLは、ファイルにデータを書き込むときの記述形式の1つで、種類の異なるソフトウェア間でデータを交換するための形式として利用されます。今回はSpire.XLS for Javaというライブラリを利用して、XMLを Excelに変換する方法を紹介します。

 下準備

1.E-iceblueの公式サイトからFree Spire. XLS for Java無料版をダウンロードしてください。

f:id:lendoris:20210428154326p:plain

2.IDEを起動して新規プロジェクトを作成してから、インストールされたファイルにあった相応しいSpire. XLS.jarを参照に追加してください。

f:id:lendoris:20210428154341p:plain

```JAVA import com.spire.xls.*;

public class xmltoexcel {
public static void main(String[] args) {
//xmlファイルをロードします。
Workbook wb = new Workbook();
wb.loadFromXml("test.xml");

    //xlsxで保存します。
    wb.saveToFile("xmltoExcel.xlsx",FileFormat.Version2013);

    //xlsで保存します。
    wb.saveToFile("xmltoExcel.xls",FileFormat.Version97to2003);
}

}

<p><strong> <img src="https://cdn-ak.f.st-hatena.com/images/fotolife/l/lendoris/20210428/20210428155121.png" alt="f:id:lendoris:20210428155121p:plain" title="" class="hatena-fotolife" itemprop="image" /></strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?