This is a migrated thread and some comments may be shown as answers.

Importing A RadDocument in a RadGridview

0 Answers 41 Views
GridView
This is a migrated thread and some comments may be shown as answers.
fred
Top achievements
Rank 1
fred asked on 15 Nov 2012, 08:19 AM
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.
:)

No answers yet. Maybe you can help?

Tags
GridView
Asked by
fred
Top achievements
Rank 1
Share this question
or