نطاق الدمج أو إلغاء الدمج Cells
Contents
[
Hide
]
يمكنك استخدام Aspose.Cells لدمج نطاق من الخلايا أو فصله. يوفر Aspose.Cells ملفRange.Merge () والمدى. إلغاء الدمج () طرق لهذا الغرض. تشرح هذه المقالة كيفية دمج نطاق من الخلايا في خلية واحدة.
مثال
ينشئ نموذج التعليمات البرمجية التالي أولاً نطاقًا - A1: D4 - ثم يدمج الخلايا الموجودة في النطاق في خلية واحدة باستخدامRange.Merge () طريقة. وبالمثل ، يمكنك تقسيم الخلايا عن طريق إنشاء نطاق واستدعاءالمدى. إلغاء الدمج ()طريقة.
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
// 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 workbook | |
Workbook workbook = new Workbook(); | |
// Access the first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Create a range | |
Range range = worksheet.Cells.CreateRange("A1:D4"); | |
// Merge range into a single cell | |
range.Merge(); | |
// Save the workbook | |
workbook.Save(dataDir+ "output.out.xlsx"); |