Hi,
I am not sure why you say the workaround wouldn't work if you set heights manually. Have you run the code you posted? It seems to work fine here.
Actually the line:
oXls.SetRowHeight(3, 800);
Will internally call the equivalent of oXls.SetAutoRowhHeight(3, false), because when you set a row height to a manual value, it is not automatic anymore. When you later do:
for I := 1 to oXls.RowCount do
oXls.SetAutoRowHeight(I, false);
It will set the rowheight of row 3 to be manual, which already was, so it won't change anything.
The only drawback of this solution is the opposite: that it will set rows which were to autofit to have a manually set size. If you don't want some rows to have fixed size, you will have to skip them when setting them to autorowheight=false.
The code:
oXls.SetRowHeight(I, oXls.DefaultRowHeight);
Is not different from
oXls.SetAutoRowHeight(I, false);
And yes, the main sense of having a defaultrowheight is so rows which have no data display at a given size. (they might be after row count, or they might be in between. For example if you don't set a value in rows 3 and leave the row empty: In that case the row will have the default row size)
I think we have figured out how to workaround the issue you see here, but I think I might need to explain in a little more detail how row heights work in Excel.
1. First of all, with all the standard data, a row height in Excel is automatic, to all the cells. If you increase the font in a cell, the row will be autofitted bigger.
2. If you set a default row height of say 500, then all empty rows will be 500. Now, when you enter data in a previously empty row, that row won't be autofitted. Excel will create a row record with no autofit and the default size, and store that. FlexCel is currently creating a row record with autofit and the default size, and this is causing the problem, because when the row is autofitted, it won't be the default size anymore.
To be more clear, in the example you sent, the bug in Excel is in the first 20 rows, not in the others. The first 20 rows should be autofitted and not default size.
We are looking into making FlexCel create a row record that is not autofitted when you call xls.SetCellValue(some empty row, column). This way, it would work as you expect it.
But a simple workaround as said is to just set the row to be not autofit. You could do it when you create the row, or in a loop at the end as in the example I sent.