Viorel-1's suggestion is correct. The result of 5/7 is the int value of 0, and the result of 5.0/7 is the double value of 0.714285714285714, which is what you need.
You can also use Microsoft.Office.Interop.Excel, and then simply set the column width regardless of these things.
Application application = new Application();
Workbook wb = application.Workbooks.Open(@"D:\test\excel\3.xlsx");
Worksheet ws = (Worksheet)wb.Worksheets[1];
((Excel.Range)ws.Cells[2, 1]).EntireColumn.ColumnWidth = 0.95;
wb.Save();wb.Close();application.Quit();
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.