Export to excel,pdf in silverlight RRS feed

  • General discussion

  • hi..

    how to Export to excel,pdf in silverlight from datagrid and generic lists.

    need ur suggetsions with examples..


    Thursday, April 19, 2012 1:01 AM

All replies

  • Hi,

    This isn't a standaard feature of Silveright.

    You can use a third party lib like Syncfusion: http://www.syncfusion.com/products/reporting-edition
    This one has libs for generating PDFs en Excels client-side in Silverlight.

    Thursday, April 19, 2012 4:51 AM
  • Excel Workbook can be converted to PDF in C# or VB.NET using Aspose.Cells API. You can try the following code in your Silverlight application and it should fix your issue.


    // Load the sample Excel file inside the workbook object.
    Aspose.Cells.Workbook workbook = new Workbook("C:\\TempDir\\SampleExcel.xlsx");
    // Save the document in PDF format
    workbook.Save("C:\\TempDir\\Output.pdf", SaveFormat.Pdf);

    You may also need to render your entire worksheet into a single PDF page. Please see this sample code.


    // Open an Excel file
    Workbook workbook = new Workbook("C:\\TempDir\\SampleInput.xlsx");
    // Implement one page per worksheet option
    PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
    pdfSaveOptions.OnePagePerSheet = true;
    // Save the PDF file
    workbook.Save("C:\\TempDir\\OutputFile.pdf", pdfSaveOptions);

    If you want to get the output PDF in PdfA1b or PdfA1a compliance that is also possible. 

    For more detail, please see this article. Thanks for reading.

    • Edited by Shakeel Faiz Wednesday, November 14, 2018 2:42 PM
    Saturday, July 28, 2018 6:52 AM