Improved multilevel array exports

With multidimensional arrays it's possible to have the longest array anywhere within the source. Searching for the longest record and using that will mean that all entries will have the correct headings.

Previously just the first row was used to get the headers, but if a subsequent row had, e.g. more comments, then these rows wouldn't have a header column to match up with.

This also include some new test cases for multidimensional arrays.