Syncfusion.XlsIO.Base
Example 


One-based row index.

AutofitRow Method

Changes the height of the specified row to achieve the best fit.
Syntax
'Declaration
 
Sub AutofitRow( _
   ByVal rowIndex As Integer _
) 
'Usage
 
Dim instance As IWorksheet
Dim rowIndex As Integer
 
instance.AutofitRow(rowIndex)
void AutofitRow( 
   int rowIndex
)

Parameters

rowIndex
One-based row index.
Example
The following code illustrates how to Auto-fit the row.
using Syncfusion.XlsIO;
            
class Program                  
{
    static void Main()
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
            //Create worksheet
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet worksheet = workbook.Worksheets[0];
            
            //Load data
            worksheet["C2"].Value = "Sample text";
            
            //Create style
            IStyle style = workbook.Styles.Add("CustomStyle");
            
            //Set font
            IFont font = style.Font;
            
            //Set font size
            font.Size = 18;
            
            //Set style
            worksheet["C2"].CellStyle = style;
            
            //Set auto fit
            worksheet.AutofitRow(2);
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 16.4460.0.40

See Also