Importing A RadDocument in a RadGridview

1 posts, 0 answers
  1. fred
    fred avatar
    28 posts
    Member since:
    Jun 2010

    Posted 15 Nov 2012 Link to this post

    Hello Telerikians.

    After an Excel Export using the Telerik Export Format tools, I want to import back the Exce(.xls) document in a Gridview.

    To do this I use the RadDocument class and the HTMLFormatProvider, as the Exported .xls files are in fact html formatted.

    But how can I import my RadDocument in a RadGridview ?

    here is my code
    using Telerik.Windows.Documents.FormatProviders;
    using Telerik.Windows.Documents.FormatProviders.Txt;
    using Telerik.Windows.Documents.FormatProviders.Xaml;
    using Telerik.Windows.Documents;
    using Telerik.Windows.Documents.Model;
    using Telerik.Windows.Documents.FormatProviders.Html;
    public RadDocument ImportExcelDataClick(object sender, RoutedEventArgs e)
                RadDocument document = null;
                IDocumentFormatProvider provider = new HtmlFormatProvider();
                OpenFileDialog openDialog = new OpenFileDialog();
                openDialog.Filter = "Excel Files|*.xls";
                openDialog.Multiselect = false;
                bool? dialogResult = openDialog.ShowDialog();
                if (dialogResult == true)
                    using (Stream stream = openDialog.File.OpenRead())
                        document = provider.Import(stream);
                return document;

    by advance Regards.
Back to Top