Document Solutions for Excel, .NET Edition | Document Solutions
File Operations / Export to PDF / Export Slicers
In This Topic
    Export Slicers
    In This Topic

    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.

    DsExcel 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.

    C#
    Copy Code
    // 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: