إنشاء نطاقات مسماة لمصنف العمل وورقة العمل
Contents
[
Hide
]
يسمح Microsoft Excel للمستخدمين بتحديد مجالات مسماة بنطاقين مختلفين: نطاق العمل (المعروف أيضا باسم نطاق عالمي) ونطاق الورقة العمل.
- يمكن الوصول إلى مجالات مسماة ذات نطاق العمل من أي ورقة عمل ضمن هذا المصنف ببساطة عن طريق استخدام اسمها.
- تتم الوصول إلى مجالات المسميات ذات نطاق ورقة العمل باستخدام مرجع لورقة العمل المعينة التي تم إنشاء المسمى فيها.
يوفر Aspose.Cells نفس الوظائف كما في Microsoft Excel لإضافة نطاقات مسماة في نطاق كتيب أو ورق العمل. عند إنشاء نطاق بتسمية نطاق ورق العمل، يجب استخدام مرجع ورق العمل في النطاق المسمى لتحديده كنطاق مسمى بنطاق ورق العمل.
إضافة نطاق مسمى بنطاق سجل العمل
This file contains 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
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create a new Workbook object | |
Workbook workbook = new Workbook(); | |
// Get first worksheet of the workbook | |
Worksheet sheet = workbook.Worksheets[0]; | |
// Get worksheet's cells collection | |
Cells cells = sheet.Cells; | |
// Create a range of Cells from Cell A1 to C10 | |
Range workbookScope = cells.CreateRange("A1", "C10"); | |
// Assign the nsame to workbook scope named range | |
workbookScope.Name = "workbookScope"; | |
// Save the workbook | |
workbook.Save(dataDir+ "WorkbookScope.out.xlsx"); |
إضافة نطاق مسمى بنطاق ورق العمل
This file contains 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
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create a new Workbook object | |
Workbook workbook = new Workbook(); | |
// Get first worksheet of the workbook | |
Worksheet sheet = workbook.Worksheets[0]; | |
// Get worksheet's cells collection | |
Cells cells = sheet.Cells; | |
// Create a range of Cells | |
Range localRange = cells.CreateRange("A1", "C10"); | |
// Assign name to range with sheet raference | |
localRange.Name = "Sheet1!local"; | |
// Save the workbook | |
workbook.Save(dataDir+ "ouput.out.xls"); |