Compare commits
No commits in common. "master" and "1.0" have entirely different histories.
18
pom.xml
18
pom.xml
|
|
@ -26,24 +26,6 @@
|
|||
<artifactId>poi</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@ package io.lroyia;
|
|||
import org.apache.commons.csv.CSVFormat;
|
||||
import org.apache.commons.csv.CSVParser;
|
||||
import org.apache.commons.csv.CSVRecord;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
|
@ -41,12 +41,12 @@ public class ApplicationRun {
|
|||
}
|
||||
File file = new File(fileUri);
|
||||
String fileName = file.getName();
|
||||
String newFileName = fileName.replace(".csv", ".xlsx");
|
||||
String newFileName = fileName.replace(".csv", ".xls");
|
||||
try(CSVParser csv = CSVParser.parse(file, Charset.forName(chartSet), CSVFormat.DEFAULT);
|
||||
OutputStream os = new FileOutputStream(newFileName)){
|
||||
List<String> headerNames = csv.getHeaderNames();
|
||||
System.out.println(headerNames);
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||
Sheet sheet = workbook.createSheet();
|
||||
Row header = sheet.createRow(0);
|
||||
int colLength = headerNames.size();
|
||||
|
|
|
|||
Loading…
Reference in New Issue