DsExcel allows users to specify custom values for the cell range by using the properties and methods of the IRange interface.
Refer to the following example code in order to set custom values to cell ranges in the worksheet.
C# |
Copy Code |
---|---|
worksheet.Range["A:F"].ColumnWidth = 15; object[,] data = new object[,]{ {"Name", "City", "Birthday", "Eye color", "Weight", "Height"}, {"Richard", "New York", new DateTime(1968, 6, 8), "Blue", 67, 165}, {"Nia", "New York", new DateTime(1972, 7, 3), "Brown", 62, 134}, {"Jared", "New York", new DateTime(1964, 3, 2), "Hazel", 72, 180}, {"Natalie", "Washington", new DateTime(1972, 8, 8), "Blue", 66, 163}, {"Damon", "Washington", new DateTime(1986, 2, 2), "Hazel", 76, 176}, {"Angela", "Washington", new DateTime(1993, 2, 15), "Brown", 68, 145} }; // Set two-dimension array value to range A1:F7 worksheet.Range["A1:F7"].Value = data; // Return a two-dimension array when get range A1:B7's value. var result = worksheet.Range["A1:B7"].Value; |