A while back I needed a way to extract values from a LocalReport object. I wrote a proof of concept application that rendered the object as Excel/Xml data, then parsed that data using OpenXml. This worked perfectly well within the very limited scope typical of a POC, but when I finally got the chance to put it to real world use there were a few predictable snags. Most were reasonably simple to resolve but one - and only one - of the reports I was rendering resulted in this lovely error:

LocalProcessingException (excelrenderer): The row item structure object corresponding to a line cannot be null

The same report rendered just fine in the report viewer; it only generated an error when rendering to Excel. Googling the error led me to this page, which made me highly suspicious it was a bug in the rendering engine, but none of the workarounds posted on that bug report worked for me. Plus, the bug report was about server - not local - reports, so whether or not it’s the same issue isn’t clear. Further Google searches didn’t yield much more information or insight into what was going on. I trudged on.

The kitchen sink debugging session that ensued spanned everything from decompiling the Reporting.WinForms assemblies searching for clues regarding which ‘row item structure’ was null to tearing apart the rdl file one tablix at a time to narrow down the troublesome section. At one point I managed to generate a slightly different exception message, something along the lines of “the conditional visibility statement failed to evaluate because the row is null.” Okay! That’s something more to go on. I removed every conditional visibility statement from the file and Viola! the report rendered.

My next step was to revert the rdl file back to its original state and apply the supposed (hint, hint) fix. Adding a nullity check such as =ISNothing(Fields!MyField.Value) to each visibility condition, I assumed, was the fix. Except when I did that, I was back to square one. Same error that I started with. Confused, I again set each visibility condition back to “Show”. This time it didn’t help. W. T. F!

I created a diff of the xml from the original rdl file and the one that worked without errors. The only differences were changes to a few table, row, and column heights and widths along with the removed conditional visibility statements. I dismissed the height and width changes as irrelevant. Obviously there’s no way those changes could have anything to do with anything, right?

RIGHT??

Several hours later - desperate, frustrated, hungry - I again reverted the rdl file to its original form. This time I only did one thing: I increased the height of the bottom-most tablix which was originally smooshed into about 3 pixels. And guess what! The report rendered to Excel correctly. Truly unbelievable that after all my efforts, the only thing I had to do was increase the height of a box on a designer form. I guess that’s the way it goes sometimes, but hopefully someone else with this issue will find this post and save themselves some time.

SSRS Designer