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

Free Support Forum - aspose.com

Cells AutoFit anomalies

Hi team,


Hi Team we are using Aspose .NET 2.0 dll v7.7.1.0.
We are facing an issue where in autofit feature is working inconsistently.

When developing and testing on my local, it is working fine for invariable length content in a merged cell. Generated cell has the target merged cell appropriately fitted.

However when we deploy template and code to development servers (IIS 6.0), for certain cases autofit is not working properly. Invariably the row is being fitted one line height shorter than required.
It is not a case of special characters or newlines in the text. Even for long plaintext strings with no newlines, sometimes the last line is cut off. (Please see attachment - There is more text in the cell than displayed because row height is not being adjusted properly).
It is happening for merged as well as non-merged cells.

For confidentiality purposes we cannot attach a sample excel or screen shot. Please revert and we will try to provide as much information as possible.

  1. According to the release notes for Aspose Cells v7.7.2.0, it is mentioned that a weird bug for AutoFit was fixed. Can you elaborate on that issue.
  2. Also if possible can you outline the steps taken to achieve autofit for merged cells. As this feature is not natively supported by Excel, we would like to know how Aspose attempts to do it.

Hi,


Well, your issue may be caused by permissions. On your servers, the IIS does not allow Aspose.Cells to access fonts directory properly. For your information, Aspose.Cells requires to access the fonts directory and use the relevant files for the operations like AutoFit Rows/Cols etc. Once, Aspose.Cells is able to access the fonts directory, then this issue will be resolved. Generally, Aspose.Cells requires Full Trust permissions because it needs to access registry settings, system files etc for operations like parsing fonts. So you need to set the necessary permission set for Aspose.Cells.

Since the release of Aspose.Cells v7.7.2, we did some enhancements regarding this, so you may try any version greater than or equal to v7.7.2. Also, the issue you are talking about (logged as “CELLSNET-41950”) refers to the similar condition where one of our users finds the issue on his env. i.e…, “Windows Server 2008 R2 with IIS 7.5”. We also suggested him to make sure Aspose.Cells should allow to access fonts on the system.

Thank you.

What kind of access does the process need on the fonts directory. To our knowledge the user that the process runs under on the servers normally should have read access on windows directories.


Also please address point number 2 above.

Hi,


Well, Aspose.Cells generally requires Full Trust permissions set for the tasks like Excel to PDF, Sheet to Image, Auto-fit rows/cols etc. for accessing and parsing fonts, see the document for your reference:
https://docs.aspose.com/display/cellsnet/Declaration
Also, we requested you to kindly try our latest version/fix: (i.e., Aspose.Cells for .NET version >= v7.7.2), did you try it and what is the results ?

For 2), the main logic is to calculate the total width of merged cells to check whether it can be enough for its contents, it is same with what we do with single cell.

Thank you.

Hi Amjad,


Assuming on the servers our application does run in medium trust mode, according to the linked document we should add the required font files to our application and then using the line
CellsHelper.FontDir = MapPath("~") + @"\Fonts";

We should be able to set the font for use.

So we tried adding the Arial font files to our application. But we are not seeing any difference.
Is any other line needed to be added while saving, processing, etc?

We seemed to notice that the anomalies occur when a word falls on the cell boundary and autofit is unable to make a correct decision whether to increase row height or not.

Hi,


Did you try the version/fix: i.e., Aspose.Cells for .NET version >= v7.7.2, as requested, we did add some enhancements to newer versions as we mentioned before.

Let us know your feedback here.

Thank you.

Tried it with the Aspose Cells v8.0.0.0 . No change

Hi,


Could you allow your application to run in Full Trust mode on one of your servers to evaluate and check if it works fine there.

Thank you.