응용 프로그램에서 생성 된 테이블을 가져 와서 Excel 스프레드 시트로 내보내는 기존 자바 코드가 있지만 지금은 Excel 스프레드 시트에 그대로 쓰고 있지만, 서식을 지정하지 않아도됩니다. Excel로 열을 두 번 클릭하는 것처럼 각 열을 확장하려면 자바 코드를 추가 할 수 싶습니다. 어떻게해야합니까?텍스트에 맞게 각 열을 확장하는 자바 코드
을 heres내가 apachi.poi.hssf.usermodel.HSSFSheet (내 코드에서 데이터 시트 변수)에 사용할 수있는 방법을 보았다
/**
* This method writes data to the row.
*
* @param header The header row for the data to be written.
*
* @param data The data rows to be written.
*
* @param rowIndex The starting index for the row.
*
* @param columnIndex The starting index for the column.
*
* @throws IOException The file cannot be written to.
*
* @throws FileNotFoundException The file cannot be found or open.
*/
private HSSFSheet dataSheet;
private int processDataToSheet(List<Excel_o> header, List<List<Excel_o>> data, int rowIndex, int columnIndex)
throws IOException, FileNotFoundException
{
//process header data
processRowData(dataSheet, rowIndex, header, columnIndex);
//write data to sheet
for(List<Excel_o> singleList: data){
//process data for the whole row.
processRowData(dataSheet, ++rowIndex, singleList, columnIndex);
}
return rowIndex;
}
엑셀 스프레드 시트에 기록하는 코드의 부분과는 말한다 autoSizeColumn이라는 메서드가 있지만 이클립스에서 드롭 다운을 보면 사용할 수있는 옵션이 없습니다. 왜 그런지 이유가 있습니까?
를 볼 ?? 당신이 나왔다는 것을 보여주세요. – Ravi
Apache POI를 사용하여 Java에서 Excel을 생성합니까? –
예 아파치 포이를 사용하여 엑셀을 생성하는 경우 – user974047