빠른 시작
5분 안에 워크북 만들기
Maven 종속성을 설치한 후, 워크북을 생성하고,
셀 값을 설정하고, 기본 서식을 적용한 다음 .xlsx에 저장합니다:
import com.aspose.cells_foss.Cell;
import com.aspose.cells_foss.Style;
import com.aspose.cells_foss.Workbook;
import com.aspose.cells_foss.Worksheet;
public class QuickStart {
public static void main(String[] args) {
try (Workbook workbook = new Workbook()) {
Worksheet sheet = workbook.getWorksheets().get(0);
sheet.setName("Report");
sheet.getCells().get("A1").putValue("Revenue");
Cell b1 = sheet.getCells().get("B1");
b1.putValue(12500.75);
Style style = b1.getStyle();
style.getFont().setBold(true);
style.setCustom("#,##0.00");
b1.setStyle(style);
sheet.getCells().getRows().get(0).setHeight(22.0);
sheet.getCells().getColumns().get(1).setWidth(14.5);
workbook.save("report.xlsx");
System.out.println("report.xlsx created.");
}
}
}