문제

How to copy and duplicate an existing IWorksheet object in SpreadsheetGear?

I want to make identical worksheet based on another worksheet (all values, formulas, named ranges etc. should follow).

도움이 되었습니까?

해결책

You can use the ISheet.CopyAfter/CopyBefore methods to copy a single sheet, in its entirety and including named ranges, to some other location. This "other location" could be within the same workbook as the sheet you are copying; or an entirely different workbook. Example:

// Make copy of "Sheet1" in sourceWorkbook after "Sheet3" in destWorkbook
IWorksheet newSheet = sourceWorkbook.Worksheets["Sheet1"].CopyAfter(destWorkbook.Worksheets["Sheet3"]);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top