//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; 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} }; worksheet.Range["A1:F7"].Value = data; worksheet.Range["A:F"].ColumnWidth = 15; //Weight less than 80. worksheet.Range["A1:F7"].AutoFilter(4, "<72"); //Copy range and ignore hidden range. var worksheet2 = workbook.Worksheets.Add(); worksheet.Range["A1:F7"].Copy(worksheet2.Range["A1:F7"], new PasteOption { AllowPasteHiddenRange = false }); //Copy range and contain hidden range. var worksheet3 = workbook.Worksheets.Add(); worksheet.Range["A1:F7"].Copy(worksheet3.Range["A1:F7"]); // Save to an excel file workbook.Save("CopyAndIgnoreHiddenRange.xlsx");
' Create a new Workbook Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim data As Object(,) = New Object(,) { {"Name", "City", "Birthday", "Eye color", "Weight", "Height"}, {"Richard", "New York", #1968-6-8#, "Blue", 67, 165}, {"Nia", "New York", #1972-7-3#, "Brown", 62, 134}, {"Jared", "New York", #1964-3-2#, "Hazel", 72, 180}, {"Natalie", "Washington", #1972-8-8#, "Blue", 66, 163}, {"Damon", "Washington", #1986-2-2#, "Hazel", 76, 176}, {"Angela", "Washington", #1993-2-15#, "Brown", 68, 145}} worksheet.Range("A1:F7").Value = data worksheet.Range("A:F").ColumnWidth = 15 worksheet.Range("A1:F7").AutoFilter(4, "<72") Dim worksheet2 = workbook.Worksheets.Add() worksheet.Range("A1:F7").Copy(worksheet2.Range("A1:F7"), New PasteOption With { .AllowPasteHiddenRange = False }) Dim worksheet3 = workbook.Worksheets.Add() worksheet.Range("A1:F7").Copy(worksheet3.Range("A1:F7")) ' save to an excel file workbook.Save("CopyAndIgnoreHiddenRange.xlsx")