Package anlavn.file
Class Excel
java.lang.Object
anlavn.file.Excel
Lớp Excel hỗ trợ đọc/ghi dữ liệu từ/vào tệp excel.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSử dụng phương thức này để đọc dữ liệu từ tệp Excel tại vị trí filePath.static void
WriteExcel
(String filePath, String workSheet, Iterator<Object[]> data) Sử dụng phương thức này để ghi dữ liệu vào tệp Excel tại vị trí filePath.static void
WriteExcel
(String filePath, String workSheet, Iterator<Object[]> data, int beginRow, int beginCol) Sử dụng phương thức này để ghi dữ liệu vào tệp Excel tại vị trí filePath.
-
Constructor Details
-
Excel
public Excel()
-
-
Method Details
-
ReadExcel
public static Iterator<Object[]> ReadExcel(String filePath, String workSheet) throws FileNotFoundException, IOException Sử dụng phương thức này để đọc dữ liệu từ tệp Excel tại vị trí filePath.- Parameters:
filePath
- là vị trí cụ thể của tệp Excel, phần mở rộng tên tệp phải là ".xlsx".workSheet
- là tên của trang tính mà bạn muốn làm việc.- Returns:
- tất cả ô dữ liệu dưới dạng Iterator từ workSheet trong tệp Excel.
- Throws:
FileNotFoundException
IOException
-
WriteExcel
public static void WriteExcel(String filePath, String workSheet, Iterator<Object[]> data) throws FileNotFoundException, IOException Sử dụng phương thức này để ghi dữ liệu vào tệp Excel tại vị trí filePath.- Parameters:
filePath
- là vị trí cụ thể của tệp Excel, phần mở rộng tên tệp phải là ".xlsx".workSheet
- là tên của trang tính mà bạn muốn làm việc.data
- all data as Iterator that you want to write to workSheet in Excel file.- Throws:
FileNotFoundException
IOException
-
WriteExcel
public static void WriteExcel(String filePath, String workSheet, Iterator<Object[]> data, int beginRow, int beginCol) throws FileNotFoundException, IOException Sử dụng phương thức này để ghi dữ liệu vào tệp Excel tại vị trí filePath.- Parameters:
filePath
- là vị trí cụ thể của tệp Excel, phần mở rộng tên tệp phải là ".xlsx".workSheet
- là tên của trang tính mà bạn muốn làm việc.data
- tất cả dữ liệu dưới dạng Iterator mà bạn muốn ghi vào workSheet trong tệp Excel.beginRow
- là số hàng bắt đầu, 0 là giá trị bắt đầu và là giá trị nhỏ nhất.beginCol
- là số cột bắt đầu, 0 là giá trị bắt đầu và là giá trị nhỏ nhất.- Throws:
FileNotFoundException
IOException
-