//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); //Load template file Home inventory.xlsx from resource to the source workbook GrapeCity.Documents.Excel.Workbook source_workbook = new GrapeCity.Documents.Excel.Workbook(); var source_fileStream = this.GetResourceStream("xlsx\\Home inventory.xlsx"); source_workbook.Open(source_fileStream); //Copy content of active sheet from source workbook to the current workbook before the first sheet var copy_worksheet = source_workbook.ActiveSheet.CopyBefore(workbook.Worksheets[0]); copy_worksheet.Name = "Copy of Home inventory"; copy_worksheet.Activate(); workbook.Theme = source_workbook.Theme;
' Create a new Workbook Dim workbook As New Workbook 'Load template file Home inventory.xlsx from resource to the source workbook Dim source_workbook As New Excel.Workbook Dim source_fileStream = GetResourceStream("Home inventory.xlsx") source_workbook.Open(source_fileStream) 'Copy content of active sheet from source workbook to the current workbook before the first sheet Dim copy_worksheet = source_workbook.ActiveSheet.CopyBefore(workbook.Worksheets(0)) copy_worksheet.Name = "Copy of Home inventory" copy_worksheet.Activate() workbook.Theme = source_workbook.Theme ' save to an excel file workbook.Save("CopyWorksheetBetweenWorkbooks.xlsx")