We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Row not adjusting to wrapped text in 2007 files

Hi,


I need some help in figuring out what is going wrong with the attached file.
Problem: we are creating both 2003 files and 2007 files with the latest Aspose version and I noticed that in the 2007 files the rows do not automatically adjust their height when long texts are wrapped, even though the style has enabled text wrapping.

I am actually unable to reproduce the issue using only you code, so we are doing something somewhere that affects this, but I can’t put my finger on it.

I’ve been checking the xml and found a difference between the file generated with our code surrounding yours, and the one generated with only Aspose code.
In sheet1.xml I found the following in the “pure” Aspose file:
but in the file with other code surrounding yours we have:

So my question is if this customHeight flag could be the cause of the row not autofitting (seems to claim that row height is manually set?), and also how we could have managed to set this flag using your code. The only row height manipulations we used was Row.setHeightMatched and I’ve tried it with true and false and also without even calling this method.

So without ever calling iCellssetRowHeight() or Row.setHeight(), how can we have set this flag?
Minor note: we did not have this issue before Aspose 7.

Best Regards
Claes

Hi,

Well, you need to extend the row height or call auto-fit function.
Please add a line after setting style, i.e.:

worksheet.autoFitRow(0);

Thank you.

Hi,


Thanks, but that’s not it; we did not need Aspose to autofit the row height. We’ve always kept the default row height in our files because this means that when text is wrapped Excel will adjust the row height when the file is opened. Now this stopped working for our 2007 files because it was logged that we had set a specific row height.

I actually found the line that caused this. Since 2006 we have used the following for all our sheets:
Sheet.getCells().setStandardHeight(12.75f);
Probably this was added long ago to fix some kind of issue, but it appears now that this is redundant (the standard height is of course 12.75 by default). It is however interesting that this still worked until Aspose version 7, and that it still works when we generate 2003 files.

I’ve removed this code for now and it seems that everything works fine without it so we are good for now.

But the question is if it is a bug that calling setStandardHeight with the default value in 2007 files is interpreted as if we set a custom height on the row (causing Excels auto adjusting of row heights to
stop working)? If it is not, I suppose it is a bug that it does not have this effect on 2003 files.

Best Regards
Claes

Hi,


Well, we think it might be due to some different behavior between different Aspose.Cells versions for the management of row’s default height property. I am afraid we need to check it later to confirm which behavior is the reasonable one. But according to what you said and it seems you have solved the issue by removing the call to cells.setStandardHeight(), that is good thing.

We will surely look into it later on when we finish some other important tasks on hand.

thank you.