Custom renderer

Posted by: stage on 8 September 2017, 12:41 pm EST

  • Posted 8 September 2017, 12:41 pm EST

    I have a custom renderer that I use in about 80% of the cells in a sheet about 60 columns by 400 rows in size. I notice that the memory was increasing after filling the sheet so I profiled a sample app where I set a 500 x 50 sheet with a renderer (a Singleton). The profiler shows that 20,000 StyleInfo objects have been created. I am setting the renderer on a cell by cell basis so it appears that a StyleInfo object is almost created for each cell. Is that correct that it should do this?
  • Replied 8 September 2017, 12:41 pm EST

    Stage -

    If you are assigning the renderer on a cell-by-cell basis then this would be correct.  You might want to try setting the renderer to the Renderer property of the DefaultStyle.
  • Replied 8 September 2017, 12:41 pm EST

    Thanks for the quick reply.


    The problem is that I have 2 types of renderer as well as not requiring a custom renderer in all cells. I have some contiguous cell ranges that I can set if I restructure my code. If I create a named style and have the named style use my custom renderer then I do avoid the individual instances of StyleInfo from my testing. Do you see anything wrong or is there something I am overlooking in that approach?

  • Replied 8 September 2017, 12:41 pm EST

    If it will help you avoid doing it on a cell-by-cell basis then that should work.
  • Replied 8 September 2017, 12:41 pm EST

    I tried setting a cell range to the Renderer but still got the same result. In each row about half the columns are using one of 2 custom renderers. In which ways can I get the same StyleInfo object used across multiple cells. Only at the sheet, column or row level? Otherwise every cell has it's own StyleInfo? 
  • Replied 8 September 2017, 12:41 pm EST

    Stage -

    If you're going to be using both renderers and splitting the columns in a row between the two then it's going to be difficult to not have each cell have its own styleinfo object.  Your options are limited to setting the renderer at the column level which will create a styleinfo object for the column but not each cell.  Your other option would be to first set the renderer for the DefaultStyle and after that set the renderer at the column or cell level to the other renderer.  At least that way you will be cutting the styleinfo objects for cells by half or more.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels