Aspose.Cells.Examples.CSharp.RowsColumns.AutofitColumn.Run C# (CSharp) Метод

Run() публичный статический Метод

public static Run ( ) : void
Результат void
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            string InputPath = dataDir + "Book1.xlsx";

            // 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[0];

        // Auto-fitting the Column of the worksheet
        worksheet.AutoFitColumn(4);

            // Saving the modified Excel file
            workbook.Save(dataDir  + "output.xlsx");
            // ExEnd:1

        }
    }
AutofitColumn