使用 SpreadsheetGear 将特殊范围从一个工作簿粘贴到另一个工作簿

Pastespecial Range from one workbook to another using SpreadsheetGear

daughter.Worksheets["DataLoad"].Range[1, 1, t.APIs.Count, 1].EntireRow.Copy(Master.Worksheets[DataLoad.Name].Range[rowIndex, 1, rowIndex + t.APIs.Count, 1].EntireRow);

复制所有公式和格式并粘贴到 .Copy 重载的范围内 我似乎无法弄清楚如何只粘贴值或只粘贴值和格式。 我的尝试:

daughter.Worksheets["DataLoad"].Range[1, 1, t.APIs.Count, 1].EntireRow.Copy(Master.Worksheets[DataLoad.Name].Range[rowIndex, 1, rowIndex + t.APIs.Count, 1].EntireRow, PasteType.ValuesAndNumberFormats)

给出错误,方法复制没有重载需要 2 个参数。我一直在网上寻找一段时间,但我似乎无法弄清楚什么是简单的解决方案。

请参阅 IRange 的文档。Copy(...). You should find an overloaded option which accepts 5 arguments, the second of which is a PasteType 允许您选择应复制范围的哪些方面的枚举。示例:

srcRange.Copy(destRange, PasteType.Values, PasteOperation.None, false, false);