요청을 통해 excel 파일을 가져와 처리합니다

1820 단어 개인
// url excel 
InputStream in = null;
HttpGet httpGet = new HttpGet(fileUrl);
try {
    HttpResponse httpResponse = client.execute(httpGet);  
    HttpEntity entity = httpResponse.getEntity();
    in = entity.getContent();
} catch (IOException e) {
    e.printStackTrace();
}
// excel
String fileName = "test.xlsx";
File file = new File(fileName);
// excel 
XSSFWorkbook wbOut = new XSSFWorkbook();
XSSFSheet sheetOut = wbOut.createSheet();
XSSFRow rowOut = null;
XSSFCell cellOut = null;

// excel 
Workbook wbRead = null;
try {
    wbRead = new XSSFWorkbook(in);
} catch (IOException e) {
    e.printStackTrace();
}
Sheet sheet0 = wbRead.getSheetAt(0);
Row row = null;
Cell cell = null;
String cellString = null;
Double d = null;
int count = 0;
Boolean flag = false;

XSSFCellStyle cellStyle = (XSSFCellStyle) wbOut.createCellStyle();
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFColor myColor = new XSSFColor(Color.ORANGE);
cellStyle.setFillForegroundColor(myColor);
// excel , , excel
for (int i = 0; i < sheet0.getLastRowNum(); i++) {
    flag = false;
    row = sheet0.getRow(i);
    rowOut = sheetOut.createRow(i);
    for(int j=0;j 
 

좋은 웹페이지 즐겨찾기