My Aspose version is 18.104.22.168, The attachment is the test excel, When I am trying to do autofitcolumn for the first three columns of the test excel, it seems not working. Below is my code.
public void TestAutoFitColumn(string InputPath, string OutputPath)
// Creating a file stream containing the Excel file to be opened
FileStream fstream = new FileStream(InputPath, FileMode.Open);
// Opening the Excel file through the file stream Workbook workbook = new Workbook(fstream); // Accessing the first worksheet in the Excel file Worksheet worksheet = workbook.Worksheets; // Auto-fitting the Column of the worksheet worksheet.AutoFitColumn(0); worksheet.AutoFitColumn(1); worksheet.AutoFitColumn(2); // Saving the modified Excel file workbook.Save(OutputPath); // Closing the file stream to free all resources fstream.Close(); }
test.zip (98.5 KB)