Gruplama, Gruplamanın Kaldırılması Satır ve Sütunlar

Giriş

Bir Microsoft Excel dosyasında, veriler için bir biçim oluşturarak tek bir fare tıklamasıyla ayrıntı seviyelerini gösterip gizleyebilirsiniz.

Hızlıca sadece özet veya başlık sağlayan satırları veya sütunları veya ayrıntıları görmek için Anahat Sembolleri 1,2,3, + ve - düğmelerini tıklayın veya bir bireysel özet veya başlık altındaki ayrıntıları görmek için sembolleri kullanabilirsiniz.

Satır ve Sütunların Grup Yönetimi

Aspose.Cells, bir Microsoft Excel dosyasını temsil eden Workbook adında bir sınıf sağlar. Workbook sınıfı, Excel dosyasındaki her sayfaya erişime izin veren bir Worksheets koleksiyonu içerir. Bir çalışsayfa Worksheet sınıfı tarafından temsil edilir. Worksheet sınıfı, çalışsayfadaki tüm hücreleri temsil eden bir Cells koleksiyonu sağlar.

Cells koleksiyonu, çalışsayfadaki satırları veya sütunları yönetmek için çeşitli yöntemler sağlar, bunlardan bazıları aşağıda daha detaylı olarak tartışılmaktadır.

Satır ve Sütunların Gruplandırılması

Satırları veya sütunları gruplamak, Cells koleksiyonunun GroupRows ve GroupColumns yöntemlerini çağırarak mümkündür. Her iki yöntem de aşağıdaki parametreleri alır:

  • İlk satır/sütun dizini, gruptaki ilk satır veya sütun.
  • Son satır/sütun dizini, gruptaki son satır veya sütun.
  • Gizli mi, satırları/sütunları gruplandırmadan sonra gizlemek için bir Boolean parametre.
Aspose::Cells::Startup();
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C
//Path of input
U16String dirPath(u"");
//Path of output
U16String outPath(u"");
//Path of input excel file
U16String sampleGroupingUngroupingRowsAndColumns = dirPath + u"sampleGroupingUngroupingRowsAndColumns.xlsx";
//Path of output excel file
U16String outputGroupingUngroupingRowsAndColumns = outPath + u"outputGroupingUngroupingRowsAndColumns.xlsx";
//Read input excel file
Workbook workbook(sampleGroupingUngroupingRowsAndColumns);
//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.GetWorksheets().Get(0);
//Grouping first seven rows and first four columns
worksheet.GetCells().GroupRows(0, 6, true);
worksheet.GetCells().GroupColumns(0, 3, true);
//Save the Excel file.
workbook.Save(outputGroupingUngroupingRowsAndColumns);
Aspose::Cells::Cleanup();

Grup Ayarları

Microsoft Excel, görüntüleme için grup ayarlarını yapılandırmanıza izin verir:

  • Detayın altında özet satırlar.
  • Ayrıntının sağında özet sütunlar.

Satır ve Sütunların Grubunu Çıkarma

Herhangi bir gruplanmış satır veya sütunu geri almak için, Cells koleksiyonunun UngroupRows ve UngroupColumns yöntemlerini çağırın. Her iki yöntem de iki parametre alır:

  • İlk satır veya sütun dizini, gruplandırılmış ilk satır/sütun.
  • Son satır veya sütun dizini, gruplandırılmış son satır/sütun.
Aspose::Cells::Startup();
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C
//Path of input
U16String dirPath(u"");
//Path of output
U16String outPath(u"");
//Path of input excel file
U16String sampleGroupingUngroupingRowsAndColumns = dirPath + u"sampleGroupingUngroupingRowsAndColumns.xlsx";
//Path of output excel file
U16String outputGroupingUngroupingRowsAndColumns = outPath + u"outputGroupingUngroupingRowsAndColumns.xlsx";
//Read input excel file
Workbook workbook(sampleGroupingUngroupingRowsAndColumns);
//Accessing the second worksheet in the Excel file
Worksheet worksheet = workbook.GetWorksheets().Get(1);
//UnGroup first seven rows and first four columns
worksheet.GetCells().UngroupRows(0, 6);
worksheet.GetCells().UngroupColumns(0, 3);
//Save the Excel file.
workbook.Save(outputGroupingUngroupingRowsAndColumns);
Aspose::Cells::Cleanup();