Apache POI ve Aspose.Cells'de Sınırlarla Çalışma

Aspose.Cells - Sınırlarla Çalışmak

Aspose.Cells bir sınıf sağlar,Çalışma kitabıbu bir Microsoft Excel dosyasını temsil eder. Workbook sınıfı, Excel dosyasındaki her çalışma sayfasına erişim sağlayan bir WorksheetCollection içerir. Bir çalışma sayfası şununla temsil edilir:Çalışma kağıdısınıf. Worksheet sınıfı bir Cellscollection sağlar. Cells koleksiyonundaki her öğe, bir nesneyi temsil eder.Cellsınıf.

Aspose.Cells, setStyle yöntemini sağlar.Cellhücrenin biçimlendirme stilini ayarlamak için kullanılan sınıf. Ayrıca, Stil nesnesistilclass kullanılır ve yazı tipi ayarlarını yapılandırmak için özellikler sağlar.

Java

 // Style the cell with borders all around.

Style style = workbook.createStyle();

style.setBorder(BorderType.BOTTOM_BORDER, CellBorderType.THIN, Color.getBlack());

style.setBorder(BorderType.LEFT_BORDER, CellBorderType.THIN, Color.getGreen());

style.setBorder(BorderType.RIGHT_BORDER, CellBorderType.THIN, Color.getBlue());

style.setBorder(BorderType.TOP_BORDER, CellBorderType.MEDIUM_DASH_DOT, Color.getBlack());

// Setting style to the cell

cell.setStyle(style);

Apache POI SS - HSSF XSSF - Sınırlarla Çalışmak

CellStyle sınıfı, Apache POI SS - HSSF ve XSSF kullanarak kenarlık ayarlarını yapmak için özellikler sağlar.

Java

 //Setting the line of the top border

style.setBorder(BorderType.TOP_BORDER,CellBorderType.THICK,Color.getBlack());

//Setting the line of the bottom border

style.setBorder(BorderType.BOTTOM_BORDER,CellBorderType.THICK,Color.getBlack());

//Setting the line of the left border

style.setBorder(BorderType.LEFT_BORDER,CellBorderType.THICK,Color.getBlack());

//Setting the line of the right border

style.setBorder(BorderType.RIGHT_BORDER,CellBorderType.THICK,Color.getBlack());

//Saving the modified style to the "A1" cell.

cell.setStyle(style);

Çalışan Kodu İndir

Örnek Kodu İndir