Cell İçindekileri Alma

Aspose.Cells - Cell İçeriğini Alma

Hücrelere erişmek için Cells.get() yöntemi mevcuttur.

Java

 //Excel dosyasındaki ilk çalışma sayfasına erişim

Çalışma sayfası çalışma sayfası = workbook.getWorksheets().get(0);

Cells hücreler = worksheet.getCells();

//Maksimum Görüntüleme Aralığına Erişin

Aralık aralığı = worksheet.getCells().getMaxDisplayRange();

int tcols = range.getColumnCount();

int trows = range.getRowCount();

System.out.println("Toplam Satır:" + trow);

System.out.println("Toplam Sütunlar:" + tcols);

// Cell B4 erişim değeri

//=====================================================

System.out.println(cells.get("B4").getValue());

Cell hücre = hücreler.get(3,1); //Cell B4 erişim değeri

System.out.println(cell.getValue());

//=====================================================

RowCollection satırları = cell.getRows();

 için (int ben = 0 ; ben< rows.getCount() ; i++)

{

	for (int j = 0 ; j < tcols ; j++)

	{

		if (cells.get(i,j).getType() != CellValueType.IS_NULL)

		{

			System.out.println(cells.get(i,j).getName() + " - " + cells.get(i,j).getValue());

		}

	}

}

Apache POI SS - HSSF XSSF - Cell İçeriğini Alma

Apache POI, hücrelerin çeşitli özelliklerine erişmek için Cell sınıfını sağlar.

Java

 Sheet sheet1 = wb.getSheetAt(0);

for (Row row : sheet1) {

    for (Cell cell : row) {

        CellReference cellRef = new CellReference(row.getRowNum(), cell.getColumnIndex());

        System.out.print(cellRef.formatAsString());

        System.out.print(" - ");

        switch (cell.getCellType()) {

            case Cell.CELL_TYPE_STRING:

                System.out.println(cell.getRichStringCellValue().getString());

                break;

            case Cell.CELL_TYPE_NUMERIC:

                if (DateUtil.isCellDateFormatted(cell)) {

                    System.out.println(cell.getDateCellValue());

                } else {

                    System.out.println(cell.getNumericCellValue());

                }

                break;

            case Cell.CELL_TYPE_BOOLEAN:

                System.out.println(cell.getBooleanCellValue());

                break;

            case Cell.CELL_TYPE_FORMULA:

                System.out.println(cell.getCellFormula());

                break;

            default:

                System.out.println();

        }

    }

}

Çalışan Kodu İndir

Örnek Kodu İndir