This project has moved and is read-only. For the latest updates, please go here.

AdjustToContents() throws KeyNotFoundException when used on a column with a number format set

Jul 3, 2012 at 1:23 AM

So I was having problems adjusting columns to fit content using AdjustToContent(), which would throw an exception every time it was used on a range. I tracked it down to a column that contained cells formatted with Style.NumberFormat.SetNumberFormatId(7);

When I removed the number formatting the exception went away.

Is there a workaround I can use to accomplish the same thing?

Thank you for your work on this, it's made my current project orders of magnitude easier.

Jul 3, 2012 at 4:02 AM
Edited Jul 3, 2012 at 4:02 AM

Good catch. I added the format id 7 = "$#,##0.00_);($#,##0.00)"

Unknown numeric format ids will just be ignored from now on.

Pick up the latest source code.

Thanks,

Jul 3, 2012 at 5:42 PM

Awesome, thanks. Everything is working with the newest build.