العمل مع الحدود في Apache POI و Aspose.Cells

Aspose.Cells - العمل مع الحدود

Aspose.Cells يوفر فصل دراسي ،دفتر العمليمثل ملف Excel Microsoft. تحتوي فئة المصنف على مجموعة أوراق العمل التي تتيح الوصول إلى كل ورقة عمل في ملف Excel. يتم تمثيل ورقة العمل بواسطةورقة عملصف دراسي. توفر فئة ورقة العمل مجموعة الخلايا. يمثل كل عنصر في مجموعة Cells عنصرًا من عناصرCellصف دراسي.

يوفر Aspose.Cells طريقة setStyle في ملفCellفئة تستخدم لتعيين نمط تنسيق الخلية. أيضًا ، فإن كائن Style لـأسلوبيتم استخدام class وتوفر خصائص لتكوين إعدادات الخط.

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 - العمل مع الحدود

توفر فئة CellStyle ميزات لضبط إعدادات الحدود باستخدام Apache POI SS - HSSF و XSSF.

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);

قم بتنزيل كود التشغيل

تنزيل نموذج التعليمات البرمجية