Re: [問題] 有人用過Json2Excel嗎
謝謝adrianshum的提醒~我後來又import了一些jar檔後
就可以順利運作了^^
但時同時又有了新的問題....
我希望可以直接讀一個內容為JSON格式的.txt檔
於是就做了一點小修改(黃色所示),可是似乎無法成功....
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import com.converter.json.excel.Json2Excel;
import java.io.*;
public class DataPreprocessing {
public static void main(String[] args) throws IOException {
FileOutputStream xlsStream = new FileOutputStream("C:\\Users\\Emily\\
Desktop\\test1.xls");
char buffer[]=new char[1024];
FileReader fr=new FileReader("C:\\Users\\Emily\\Desktop\\test.txt");
int len=fr.read(buffer);
String s=new String(buffer,0,len);
Json2Excel.build(xlsStream,s,new String[] { "id", "name"},
new String[] { "id", "name" });
xlsStream.close();
fr.close();
}
}
請問是Json2Excel不能直接匯入檔案嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.115.227.65
→
12/28 22:23, , 1F
12/28 22:23, 1F
※ 編輯: adnee0724 來自: 140.115.227.65 (12/28 22:26)
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):