EPPLUS AutoFit cells
<p>how can i set autosize on my cells, based on the max length of one input.</p>

<pre><code>using (rng = workSheet.Cells["A1:G1"])
{
    rng.Style.Font.Bold = true;
    rng.Style.Fill.PatternType = ExcelFillStyle.Solid;
    rng.Style.Fill.BackgroundColor.SetColor(Color.DarkBlue);
    rng.Style.Font.Color.SetColor(Color.White);

}

using (ExcelRange col = workSheet.Cells[2, 6, 7, 7])
{
    col.Style.Numberformat.Format = "yyyy-mm-dd HH:mm";
    col.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;

}

for (int i = 1; i &lt;= a; i++)
{
    workSheet.Cells["A1"].Value = "RU_ID";
    workSheet.Cells["B1"].Value = "COR_REQ_ID";
    workSheet.Cells["C1"].Value = "RU_NAME";
    workSheet.Cells["D1"].Value = "PARENT_RU_NAME";
    workSheet.Cells["E1"].Value = "ADJUSTMENT_STATE";
    workSheet.Cells["F1"].Value = "COR_START";
    workSheet.Cells["G1"].Value = "COR_END";
}
...

rng.AutoFitColumns();
string path = @"D:\excel\test.xlsx";
Stream stream = File.Create(path);
excel.SaveAs(stream);
stream.Close();
byte[] data = File.ReadAllBytes(path);

}
</code></pre>

<p>The only thing that AutoFitColumn is doing is to bring the cell to the size of the header, as if i have the header as "STH" and the inputs as "Something good", "something to increase cell size" than AutoFitColumn will set the size based on "STH" not "something to increase cell size".
Thanks in advance for the help.</p>