Forum Discussion

Aure's avatar
Aure
Occasional Contributor
10 years ago

Export data from RadTreeListView (Telerik ThirdParty)

Hi Everyone, I need to export the results contained in a RadTreeListView object. There is a lot of data inside and i can't afford to process cells and rows one by one (in terms of testing time) ...
  • HKosova's avatar
    HKosova
    10 years ago

    Try using the dotNET object obtained directly from the tree list object. Maybe the global dotNET object uses a different .NET version than that used in the app, and that causes conflicts.

    Also note that Export needs a Stream object, not a StreamWriter. A FileStream should work.

     

    var dotNET2 = RootApp.Grid.ContentControl.ContentPresenter.RadTreeListView.ClrAppDomain.dotNET;
    
    // Use dotNET2 to create parameters for the Export method call // Initialize GridViewExportOptions var options = dotNET2.Telerik_Windows_Controls.GridViewExportOptions.zctor(); options.Encoding = dotNET2.System_Text.Encoding.Unicode; options.ShowColumnHeaders = true; options.ShowColumnFooters = true; // Initialize the FileStream var fileStream = dotNET2.System_IO.File.Create(path); RootApp.Grid.ContentControl.ContentPresenter.RadTreeListView.Export(fileStream, options); fileStream.Close();