xlsx
फ़ाइल पढ़ने के लिए मैं अपाचे पीओआई का उपयोग कर रहा हूं, मैंने ज़िप डाउनलोड किया है और मेरे सर्वलेट स्थान webcontent/web-inf/lib
में निम्न jsrs लगाया है और कॉन्फ़िगर बिल्ड पथ ग्रहण के माध्यम सेjava.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException
और इस प्रकार मेरे कोड दिखता है,
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
File uploadedFile = new File(fpath, fileName);
item.write(uploadedFile);
String mimeType = (Files.probeContentType(uploadedFile.toPath())).toString();
System.out.println(mimeType);
if(mimeType.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"))
{
FileInputStream file = new FileInputStream(uploadedFile);
XSSFWorkbook workbook = new XSSFWorkbook(file);
for (int i =0; i < workbook.getNumberOfSheets(); i++)
{
XSSFSheet sheet = workbook.getSheetAt(i);
Iterator<Row> row = sheet.iterator();
while(row.hasNext()) {
Iterator<Cell> cellIterator = ((Row) row).cellIterator();
while(cellIterator.hasNext()) {
Cell cell1 = cellIterator.next();
switch(cell1.getCellType())
{
case Cell.CELL_TYPE_BOOLEAN:
System.out.print(cell1.getBooleanCellValue() + "\n");
break;
case Cell.CELL_TYPE_NUMERIC:
System.out.print(cell1.getNumericCellValue() + "\n");
break;
case Cell.CELL_TYPE_STRING:
System.out.print(cell1.getStringCellValue() + "\n");
break;
}
}
इस हालांकि प्रदर्शित नहीं करता है और ग्रहण पर त्रुटियों यह निम्न त्रुटियों से पता चलता है जब मैं कोड चलाने का प्रयास
मेरी गलती क्या है? इसे कैसे हल करें?
ठीक है। लेकिन ग्रहण में इसे कैसे जोड़ना है ?? –
मैन्युअल रूप से: जार प्राप्त करें, प्रोजेक्ट, गुण, जावा बिल्ड पथ पर जाएं, बाहरी जार जोड़ें और .jar फ़ाइल का चयन करें। – Mena
मेरे पास एक स्विंग ऐप ठीक काम कर रहा है, विंडोज़ पर एक्सेल फाइलें पढ़ रहा है लेकिन मेरी लिनक्स वर्चुअल मशीन पर, मुझे java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException ???? Xmlbeans जार शामिल है। –