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