الحصول على نطاقات الخلايا
Contents
[
Hide
]
سيناريوهات الاستخدام المحتملة
عندما تحتاج فقط إلى تعديل بعض البيانات على ورقة العمل، تحتاج إلى معرفة مدى البيانات الكاملة في ورقة العمل. يوفر Aspose.Cells for Node.js via C++ هذه الميزة. يوفر Aspose.Cells for Node.js via C++ الخصائص والطرق التالية لمساعدتك على تحقيق أهدافك.
- Cells.getMaxDisplayRange
- Cells.getMaxRow
- Cells.getMaxDataRow
- Cells.getMaxColumn
- Cells.getMaxDataColumn
الحصول على مدى الخلايا باستخدام Aspose.Cells for Node.js via C++
يوضح هذا المثال كيف:
- إنشاء دفتر عمل.
- إضافة بيانات إلى الخلايا في ورقة العمل الأولى.
- الحصول على الخلايا Range.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AsposeCells = require("aspose.cells.node"); | |
var workbook = new AsposeCells.Workbook(AsposeCells.FileFormatType.Xlsx); | |
var cells = workbook.getWorksheets().get(0).getCells(); | |
//Setting the value to the cells | |
var cell = cells.get("A1"); | |
cell.putValue("Fruit"); | |
cell = cells.get("B1"); | |
cell.putValue("Count"); | |
cell = cells.get("C1"); | |
cell.putValue("Price"); | |
cell = cells.get("A2"); | |
cell.putValue("Apple"); | |
cell = cells.get("A3"); | |
cell.putValue("Mango"); | |
cell = cells.get("A4"); | |
cell.putValue("Blackberry"); | |
cell = cells.get("A5"); | |
cell.putValue("Cherry"); | |
cell = cells.get("B2"); | |
cell.putValue(5); | |
cell = cells.get("B3"); | |
cell.putValue(3); | |
cell = cells.get("B4"); | |
cell.putValue(6); | |
cell = cells.get("B5"); | |
cell.putValue(4); | |
cell = cells.get("C2"); | |
cell.putValue(5); | |
cell = cells.get("C3"); | |
cell.putValue(20); | |
cell = cells.get("C4"); | |
cell.putValue(30); | |
cell = cells.get("C5"); | |
cell.putValue(60); | |
cell = cells.get("E10"); | |
var temp = workbook.createStyle(); | |
temp.getFont().setColor(new AsposeCells.Color(255, 0, 0)); | |
cell.setStyle(temp); | |
// Get max display range of worksheet | |
var range = cells.getMaxDisplayRange(); | |
//get maximum row index of cell which contains data or style. | |
console.log(cells.getMaxRow()); | |
//get maximum row index of cell which contains data. | |
console.log(cells.getMaxDataRow()); | |
//get maximum column index of cell which contains data or style. | |
console.log(cells.getMaxColumn()); | |
//get maximum column index of cell which contains data. | |
console.log(cells.getMaxDataColumn()); |