Slicer ı biçimlendirme (C++)
Contents
[
Hide
]
Olası Kullanım Senaryoları
Microsoft Excel’de dilimleyiciyi biçimlendirebilirsiniz; sütun sayısını ayarlayarak veya stilini belirleyerek vb. Aspose.Cells ayrıca bunu Slicer.GetNumberOfColumns() ve Slicer.GetStyleType() özellikleri kullanarak yapmanıza olanak tanır.
Dilimleyici Biçimlendirme
Lütfen aşağıdaki kodu inceleyin; bu, dilimleyici içeren örnek Excel dosyasını yükler. Dilimleyiciye erişir ve sütun sayısını ile stil türünü ayarlar ve çıktı Excel dosyası olarak kaydeder. Ekran görüntüsü, örnek kodun çalıştırılmasından sonra dilimleyicinin nasıl göründüğünü gösterir.
Örnek Kod
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C
// Load sample Excel file containing slicer.
Workbook workbook(u"sampleFormattingSlicer.xlsx");
// Access first worksheet.
Worksheet worksheet = workbook.GetWorksheets().Get(0);
// Access the first slicer inside the slicer collection.
Slicer slicer = worksheet.GetSlicers().Get(0);
// Set the number of columns of the slicer.
slicer.SetNumberOfColumns(2);
// Set the type of slicer style.
slicer.SetStyleType(SlicerStyleType::SlicerStyleLight6);
// Save the workbook in output XLSX format.
workbook.Save(u"outputFormattingSlicer.xlsx", SaveFormat::Xlsx);
std::cout << "Slicer formatted and workbook saved successfully!" << std::endl;
Aspose::Cells::Cleanup();
}