In my web application users can get excel report. The problem is : when one of the cells in row contains long text, so all row is grow, and excel report looks bad. I need to set maximum row height for all rows in my excel document.
public bool UseOldFormat { get; set; }
public ExcelFile GetExcelFile()
{
var excel = new ExcelFile();
if (!string.IsNullOrEmpty(SourceFileName))
{
if (SourceFileName.EndsWith("xls"))
{
excel.LoadXls(SourceFileName);
}
else
{
excel.LoadXlsx(SourceFileName, XlsxOptions.PreserveMakeCopy);
}
}
return excel;
}
public void GenerateReport(string fileName)
{
ExcelFile excel = GetExcelFile();
InsertDataInExcel(excel);
if (UseOldFormat)
{
excel.SaveXls(fileName);
}
else
{
excel.SaveXlsx(fileName);
}
}
Can’t find in excel options this function. Can anybody help?
You can specify the range of columns and then can adjust width,height of them as below :
visit :http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.namedrange.rowheight.aspx