WinUI | ComponentOne
Controls / FlexViewer (Beta) / Export
In This Topic
    Export
    In This Topic

    FlexViewer provides export functionality that can be used to send your report to the coworkers or clients as a digital file, instead of printing them. The FlexViewer control provides an option to export reports in various formats at runtime using Export Filter drop-down present in the Export Menu.

    Format Description
    Paged HTML (*.html) Creates one HTML file for each page in the report. The HTML pages contain links that let the user navigate the report.
    Plain HTML (*.html) Creates a single HTML file with no drill-down functionality.
    PDF with non-embedded (linked) fonts (*.pdf) Creates a PDF file that can be viewed on any computer equipped with Adobe's Acrobat viewer or browser plug-ins.
    PDF/A with embedded fonts (*.pdf) Creates a PDF file with embedded font information for extra portability.
    RTF (*.rtf) Creates an RTF file that can be opened by most popular word processors (for example, Microsoft Word, WordPad). It can be saved as Paged or Open XML document.
    Microsoft Excel 97 (*.xls) Creates an XLS file that can be opened by Microsoft Excel.
    Microsoft Excel Open XML (*.xlsx) Creates an XLS file that can be opened by Microsoft Excel 2007 and later.
    Open XML Word (*.docx) Creates a DOCX file that can be opened by Microsoft Word 2007 and later.
    Compressed Metafile (*.zip) Creates a compressed metafile file, of the type EmfOnly, EmfPlusOnly,and EmfPlusDual.
    TIFF (*.tiff), BMP, PNG, JPEG, GIF images Create image file of type TIFF (Tag Image File Format), BMP (Bitmap Images), PNG(Portable Network Graphic), JPEG or GIF.
    Comma Separated Values Create a csv file that gets opened in Microsoft Excel 2007 and later by default.

    After selecting the format in the Export Filter drop-down and clicking the Export button, the Save As dialog box opens that allows you to export a report to different formats as given above.

    Export report

    Export FlexReport Programmatically

    Besides exporting FlexReport to different file formats at runtime, you can also export them programmatically. For exporting reports into different file formats, you need the respective classes available in the C1.Document API. The following example for exporting a report uses a sample created in View Documents.

    Render FlexReport using HTMLFilter class

    FlexReport allows you to export a report to HTML format using the HtmlFilter class, which renders the report into HTML streams or files as showcased in the following code.

    C#
    Copy Code
    private void myButton_Click(object sender, RoutedEventArgs e)
    {
      HtmlFilter f = new HtmlFilter();
      f.FileName = @"D:\Reports\ProductReport.html";
      flexReport.RenderToFilter(f);     
    }
    

    Similarly, the reports or PDF documents can be export in different formats using their respective classes and the RenderToFilter method, which renders the report or PDF into the ExportFilter object.