Auto fit row adds extra space in cells

Hi Aspose Team,

I am currently using Aspose.Cells for formatting the excel files (office version: 2007), one of the formatting item is to wrap the text in a particular column and Auto size all the rows in the worksheet. However, after execution, white space is being added to the cells and due to this the row height increase unnecessarily.

The sample files are attached herewith.

<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

the code used is:

private int CreateReport(int startRow, string[,] cols, XmlNodeList xml)

{

Cell cell;

Style style;

for (int i = 0; i < xml.Count; i++)

{

for (int j = 0; j < cols.GetLength(0); j++)

{

if (xml[i].Attributes[cols[j, 1]] != null)

{

cell = worksheet.Cells[startRow, j];

style = cell.GetStyle();

style.VerticalAlignment = TextAlignmentType.Top;

switch (cols[j, 2])

{

case “0”:

cell.PutValue(xml[i].Attributes[cols[j, 1]].Value);

style.Number = Convert.ToInt32(cols[j, 2]);

break;

case “1”:

cell.PutValue(Convert.ToInt32(xml[i].Attributes[cols[j, 1]].Value));

style.Number = Convert.ToInt32(cols[j, 2]);

break;

case “10”:

style.Custom = “0.0%”;

cell.PutValue(Convert.ToDecimal(xml[i].Attributes[cols[j, 1]].Value));

break;

}

if (j == 2) style.IsTextWrapped = true;

worksheet.AutoFitRow(startRow);

cell.SetStyle(style);

}

}

startRow++;

}

return ++startRow;

}

v

Please let us know what the issue is here or direct us to a solution

Hi,


Please first try our latest version/fix v7.0.1.1: Please download: Aspose.Cells for .NET v7.0.1.1

If you still find any issue, then we need complete details. We are not sure how the white space is added unnecessarily to the cells and due to this rows heights are increased. Since you are importing data from some XML source, for which we are not sure, may be you got unnecessary spaces in your source xml data. Please create a simple console demo application, zip it and post it here to show the issue with v7.0.1.1. We will check it soon.

Thank you.