[]
        
(Showing Draft Content)

Export Slicers

Slicers are visual filters that are used to filter data in Excel spreadsheets. You can filter the data by clicking on desired type of data in slicer.

GcExcel supports the export of Excel spreadsheet containing a slicer to PDF document. So, if an Excel spreadsheet containing a slicer is exported to PDF, the resulting PDF will contain the applied slicer.

Using Code

Refer to the following example code to export slicers to PDF document.

// Fetch default worksheet 
IWorksheet worksheet = workbook.Worksheets[0];
worksheet.Range["A:F"].ColumnWidth = 13;
// Set Data
worksheet.Range["A1:F16"].Value = sourceData;
ITable table = worksheet.Tables.Add(worksheet.Range["A1:F16"], true);
table.Columns[3].DataBodyRange.NumberFormat = "$#,##0.00";
// Create slicer cache for table
ISlicerCache cache = workbook.SlicerCaches.Add(table, "Category", "categoryCache");

// Add two slicers for Category column
ISlicer slicer1 = cache.Slicers.Add(workbook.Worksheets["Sheet1"], "cate1", "Category", 300, 50, 100, 200);

// Saving workbook to pdf
workbook.Save(@"ConvertExcelSlicersToPDFExport.pdf");

Limitations

The following is not supported while exporting slicers to PDF documents:

  • Pivot table slicers or report connections

  • Custom height of slicer items

  • Slicer settings

  • Slicer styles (except the color property)

  • Slicer header styles

  • Scroll viewer which surrounds the items panel

  • Slicer item styles for the "No data" visual state group