// 新規ワークブックの作成 var workbook = new GrapeCity.Documents.Excel.Workbook(); IRange targetRange = workbook.ActiveSheet.Range["A1:C9"]; // データを設定 targetRange.Value = new object[,] { {"Player", "Side", "Commander"}, {1, "Soviet", "AI"}, {2, "Soviet", "AI"}, {3, "Soviet", "Human"}, {4, "Allied", "Human"}, {5, "Allied", "Human"}, {6, "Allied", "AI"}, {7, "Empire", "AI"}, {8, "Empire", "AI"} }; // 小計 targetRange.Subtotal(groupBy: 2, // Side subtotalFunction: ConsolidationFunction.Count, totalList: new[] { 2 } // Side ); targetRange.AutoFit(); // xlsx ファイルに保存 workbook.Save("AddSubtotal.xlsx");
' 新規ワークブックの作成 Dim workbook As New Workbook Dim targetRange As IRange = workbook.ActiveSheet.Range("A1:C9") ' データを設定 targetRange.Value = New Object(,) { {"Player", "Side", "Commander"}, {1, "Soviet", "AI"}, {2, "Soviet", "AI"}, {3, "Soviet", "Human"}, {4, "Allied", "Human"}, {5, "Allied", "Human"}, {6, "Allied", "AI"}, {7, "Empire", "AI"}, {8, "Empire", "AI"} } ' 小計 targetRange.Subtotal(groupBy:=2, ' Side subtotalFunction:=ConsolidationFunction.Count, totalList:={2} ' Side ) targetRange.AutoFit() ' xlsx ファイルに保存 workbook.Save("AddSubtotal.xlsx")