//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet sheet = workbook.Worksheets[0]; // Set text for some cells. sheet.Range["A1"].Value = "Document"; sheet.Range["A2"].Value = "Solutions For .NET"; sheet.Range["B1"].Value = "Document"; sheet.Range["B2"].Value = "Solutions For .NET"; //Set font size of cell "A2" sheet.Range["A2"].Font.Size = 20; // Set bestFitColumns/bestFitRows as true. sheet.PageSetup.BestFitColumns = true; sheet.PageSetup.BestFitRows = true; // Set print gridline and heading. sheet.PageSetup.PrintGridlines = true; sheet.PageSetup.PrintHeadings = true;
' Create a new Workbook Dim workbook As New Workbook Dim sheet As IWorksheet = workbook.Worksheets(0) With sheet.Range ' Set text for some cells. !A1.Value = "Document" !A2.Value = "Solutions For .NET" !B1.Value = "Document" !B2.Value = "Solutions for .NET" 'Set font size of cell "A2" !A2.Font.Size = 20 End With With sheet.PageSetup ' Set bestFitColumns/bestFitRows as true. .BestFitColumns = True .BestFitRows = True ' Set print gridline and heading. .PrintGridlines = True .PrintHeadings = True End With ' save to a pdf file workbook.Save("ConfigureBestFitRowColumn.pdf")