Completed
Last Updated: 17 Feb 2020 11:56 by ADMIN
Release R1 2020 SP1
George C.
Created on: 04 Jan 2020 12:36
Category: TreeView
Type: Bug Report
0
RadTreeView: TreeViewSpreadExport throws exception when ExportChildNodesGrouped is true and exporting tree nodes with level bigger than 7

Greetings,

While testing the exporting feature of RadTreeView, I noticed the following issue :

Using the code below , everything works just fine :

Me.RadTreeView1.RightToLeft = System.Windows.Forms.RightToLeft.Yes
 
Dim exporter As TreeViewSpreadExport = New TreeViewSpreadExport(Me.RadTreeView1)
 
AddHandler exporter.CellFormatting, AddressOf exporter_CellFormatting
 
exporter.ExportFormat = SpreadExportFormat.Xlsx
 
exporter.ExportVisualSettings = False
exporter.ExportImages = False
exporter.ExportChildNodesGrouped = True
exporter.CollapsedNodeOption = HiddenOption.ExportAlways
 
Dim renderer As SpreadExportRenderer = New SpreadExportRenderer()
 
exporter.RunExport("D:\test.xlsx", renderer)

 

But, the following line of the code raises an error in a specific circumasntance (I describe it more, further in the thread)   :

exporter.RunExport("D:\test.xlsx", renderer)

 

Error Screenshot is attached : 1.jpg

Details about the error :

System.ArgumentOutOfRangeException
  HResult=0x80131502
  Message=value should be greater or equal than 0 and less or equal than 7.
Parameter name: value
  Source=Telerik.Windows.Documents.Spreadsheet
  StackTrace:
 
at Telerik.WinControls.UI.RadButtonBase.buttonElement_Click(Object sender, EventArgs e)
   at Telerik.WinControls.RadElement.OnClick(EventArgs e)
   at Telerik.WinControls.UI.RadButtonElement.OnClick(EventArgs e)
   at Telerik.WinControls.RadElement.DoClick(EventArgs e)
   at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
   at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)
   at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at Telerik.WinControls.RadControl.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)

 

 

The Specific Circumstance :

In my RadTreeView's NodeMouseClick , I add some child nodes to the node which is clicked, at runtime :

Dim _Node1 As RadTreeNode = e.Node.Nodes.Add("Node 1")
Dim _Node2 As RadTreeNode = e.Node.Nodes.Add("Node 2")
Dim _Node3 As RadTreeNode = e.Node.Nodes.Add("Node 3")

 

Then I found out that setting "exporter.ExportChildNodesGrouped" to True causes the error. But if it is set to false, no error raised even in the above Circumstance.

P.S  Normally setting "exporter.ExportChildNodesGrouped" to True or False doesn't cause any error, but adding some child nodes at run time surly does.

 

Thanks for your attention.

 


7 comments
ADMIN
Nadya | Tech Support Engineer
Posted on: 28 Jan 2020 11:15

Hello George,

After discussing it with the team, we confirm this issue as a bug report. I have logged it in our feedback portal by making this thread public. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik Points.

Do not hesitate to contact us if you have any other questions or concerns.

Regards,
Nadya
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
George C.
Posted on: 24 Jan 2020 22:33

Greetings,

I tested your code in my side, However, there would be no need to test such a code, as your code is a simple solution to make sure exporting doesn't raise error in the case sub nodes are more than the number that spreadsheet can actually handle.

I'm not sure if there would be a fix or solution to this issue, not also sure if it is Excel's fault. But the limitation makes this awesome feature nearly imperfect, as in many cases there would be even more sub nodes than 7 or so, though your code makes sure that at least, there would be no error raised, regarding the limitation.

 

Thanks for you reponses and attention,

Best Wishes. 

ADMIN
Nadya | Tech Support Engineer
Posted on: 24 Jan 2020 16:22

Hello George,

The provided information is greatly appreciated. You are right that there is an issue which appears to be a general limitation in Excel. I tested it on my end and I reproduced the error that you described. In order to workaround this I can suggest you to go through all the nodes and check if the node level is bigger than 7 before ExportChildNodesGrouped is set. Please refer to the following code snippet that I add in the RadButton1_Click event:

Dim level As Integer = 0
Dim nodes As Stack(Of RadTreeNode) = New Stack(Of RadTreeNode)
For index = 0 To Me.RadTreeView1.Nodes.Count - 1
    nodes.Push(Me.RadTreeView1.Nodes(index))
Next

While nodes.Count > 0
    Dim node As RadTreeNode = nodes.Pop()
    If node.Level > level Then
        level = node.Level
    End If

    For index = 0 To node.Nodes.Count - 1
        nodes.Push(node.Nodes(index))
    Next
End While

If level <= 7 Then
    exporter.ExportChildNodesGrouped = True
Else
    exporter.ExportChildNodesGrouped = False
End If

Could you please give this solution a try and let me know how it works for you?

I am looking forward to your reply.

Regards,
Nadya
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
George C.
Posted on: 22 Jan 2020 09:38

P.S I also did a simple test to check if the issue is only in the case of adding nodes at runtime or not.

There seems to be a general limitation as the error raised again by adding the same amount of sub nodes programatically.

 

George C.
Posted on: 22 Jan 2020 09:22

Greetings,

Sorry for a late response, I've been working hard on the issue to find out the cause, and hopefully I did.

As you provided a sample test project, I tested your project and everything went well as you said. So I thought my coding would definitely be the cause. Therefore, I spent almost half a week to check it out and do some tests, no result and success of finding the cause though.

As the last try, I compared your project with mine to see what differences there are among them, which obviously helped finding the cause:

I did some changes in the below section of your project, actually by adding some more sub notes : 

Private Sub RadTreeView1_NodeMouseClick(sender As Object, e As RadTreeViewEventArgs)

        Dim _Node1 As RadTreeNode = e.Node.Nodes.Add("Node 1")

        Dim _Node2 As RadTreeNode = e.Node.Nodes.Add("Node 2")

        Dim _Node3 As RadTreeNode = e.Node.Nodes.Add("Node 3")

        Dim _Node3_1 As RadTreeNode = _Node3.Nodes.Add("Node 3")

        Dim _Node3_1_1 As RadTreeNode = _Node3_1.Nodes.Add("Node 3")

        Dim _Node3_1_1_1 As RadTreeNode = _Node3_1_1.Nodes.Add("Node 3")

        Dim _Node3_1_1_1_1 As RadTreeNode = _Node3_1_1_1.Nodes.Add("Node 3")

        Dim _Node3_1_1_1_1_1 As RadTreeNode = _Node3_1_1_1_1.Nodes.Add("Node 3")

        Dim _Node3_1_1_1_1_1_1 As RadTreeNode = _Node3_1_1_1_1_1.Nodes.Add("Node 3")

        Dim _Node3_1_1_1_1_1_1_1 As RadTreeNode = _Node3_1_1_1_1_1_1.Nodes.Add("Node 3")

    End Sub

 

From node "_Node3_1" to "_Node3_1_1_1_1_1_1_1" , there are nodes. Do you remember that number? In the first post of this thread, I attached the picture below:

 

Conclusion : There seems to be a limitation of number of sub nodes, in the case of adding nodes to another existing node at runtime, However there might also be the same problem when nodes are added programmatically which is not tested yet.

I hope you can work it out to make this feature even better. I'm always all ready to help you as much as I can, doing extended tests. Please let me know if there is anything more I can do.

Best Wishes.

 

 

ADMIN
Nadya | Tech Support Engineer
Posted on: 08 Jan 2020 14:15

Hello George,

The provided information is greatly appreciated. I use the same code that you provided in my test project in order to replicate the issue that you are facing. However, TreeViewSpreadExport seems to work properly on my side when ExportChildNodesGrouped property is set to True and add nodes at run time. Please refer to the attached gif file. Could you please give this project a try and let me know how it works for you? Feel free to modify it in a way to reproduce the issue that you are facing. Thus, we would be able to assist you further.

I am converting this forum thread into a support ticket in order to allow attachments. You can find the ticket in Your Telerik Account.

I am looking forward to your reply.

Regards,
Nadya
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
George C.
Posted on: 04 Jan 2020 13:02

*Xslx

I guess there is no editing option to edit threads and posts content.