//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); // Open an excel file. var fileStream = GetResourceStream("xlsx\\AgingReport.xlsx"); // Get the possible import names in the file. // The names[0] and names[1] are sheet names: "Aging Report", "Invoices". // The names[2] and names[3] are table names: "'Aging Report'!tblAging", "Invoices!tblInvoices". var names = GrapeCity.Documents.Excel.Workbook.GetNames(fileStream); // Import the data of a table "'Aging Report'!tblAging" from the fileStream. var data = GrapeCity.Documents.Excel.Workbook.ImportData(fileStream, names[2]); // Assign the data to current workbook. workbook.Worksheets[0].Range[0, 0, data.GetLength(0), data.GetLength(1)].Value = data; // Save to an excel file workbook.Save("ImportDataForTable.xlsx");
' Create a new Workbook Dim workbook As New Workbook ' Open an excel file Dim fileStream = GetResourceStream("xlsx\\AgingReport.xlsx") ' Get the possible import names in the file ' The names[0] And names[1] are sheet names: "Aging Report", "Invoices". ' The names[2] And names[3] are table names: "'Aging Report'!tblAging", "Invoices!tblInvoices". Dim names = GrapeCity.Documents.Excel.Workbook.GetNames(fileStream) ' Import the data of a table "'Aging Report'!tblAging" from the fileStream. Dim data = GrapeCity.Documents.Excel.Workbook.ImportData(fileStream, names(2)) 'Assign the data to current workbook workbook.Worksheets(0).Range(0, 0, data.GetLength(0), data.GetLength(1)).Value = data ' save to an excel file workbook.Save("ImportDataForTable.xlsx")