// 新規ワークブックの作成 var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; IWorksheet worksheet2 = workbook.Worksheets.Add(); worksheet.Range["B3:D12"].Value = 5; worksheet.Range["B3:D12"].Interior.Color = Color.LightGreen; // コピー worksheet.Range["B3:D12"].Copy(worksheet.Range["E5"]); // 切り取り worksheet.Range["B3:D12"].Cut(worksheet.Range["I5:K14"]); worksheet.Range["I1:K2"].Value = 2; worksheet.Range["I1:K2"].Interior.Color = Color.Pink; // シートをまたいだコピーと切り取り worksheet.Range["I1:K2"].Cut(worksheet2.Range["H5"]); worksheet.Range["G4:H5"].Copy(worksheet2.Range["A1"]); // xlsx ファイルに保存 workbook.Save("CutCopyRange.xlsx");
' 新規ワークブックの作成 Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim worksheet2 As IWorksheet = workbook.Worksheets.Add() worksheet.Range("B3:D12").Value = 5 worksheet.Range("B3:D12").Interior.Color = Color.LightGreen ' コピー worksheet.Range("B3:D12").Copy(worksheet.Range!E5) ' 切り取り worksheet.Range("B3:D12").Cut(worksheet.Range("I5:K14")) worksheet.Range("I1:K2").Value = 2 worksheet.Range("I1:K2").Interior.Color = Color.Pink ' シートをまたいだコピーと切り取り worksheet.Range("I1:K2").Cut(worksheet2.Range!H5) worksheet.Range("G4:H5").Copy(worksheet2.Range!A1) ' xlsx ファイルに保存 workbook.Save("CutCopyRange.xlsx")