// 新規ワークブックの作成 var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; object[,] data = new object[,]{ {"名前", "地域", "生年月日", "血液型", "体重", "身長"}, {"伊達", "西地区", new DateTime(1968, 6, 8), "A", 67, 165}, {"上杉", "北地区", new DateTime(1972, 7, 3), "B", 62, 134}, {"最上", "西地区", new DateTime(1964, 3, 2), "O", 72, 180}, {"片倉", "南地区", new DateTime(1972, 8, 8), "A", 66, 163}, {"田村", "東地区", new DateTime(1986, 2, 2), "A", 76, 176}, {"津軽", "北地区", new DateTime(1993, 2, 15), "AB", 68, 145} }; worksheet.Range["A1:F7"].Value = data; worksheet.Columns[2].AutoFit(); // データバールールを設定 IDataBar dataBar = worksheet.Range["E2:E7"].FormatConditions.AddDatabar(); dataBar.MinPoint.Type = ConditionValueTypes.LowestValue; dataBar.MinPoint.Value = null; dataBar.MaxPoint.Type = ConditionValueTypes.HighestValue; dataBar.MaxPoint.Value = null; dataBar.BarFillType = DataBarFillType.Gradient; dataBar.BarColor.Color = Color.Green; dataBar.Direction = DataBarDirection.Context; dataBar.AxisColor.Color = Color.Red; dataBar.AxisPosition = DataBarAxisPosition.Automatic; dataBar.NegativeBarFormat.BorderColorType = DataBarNegativeColorType.Color; dataBar.NegativeBarFormat.BorderColor.Color = Color.Blue; dataBar.NegativeBarFormat.ColorType = DataBarNegativeColorType.Color; dataBar.NegativeBarFormat.Color.Color = Color.Pink; dataBar.ShowValue = false; // xlsx ファイルに保存 workbook.Save("CreateDatabBarRule.xlsx");
' 新規ワークブックの作成 Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim data As Object(,) = { {"名前", "地域", "生年月日", "血液型", "体重", "身長"}, {"伊達", "西地区", #1968/6/8#, "A", 67, 165}, {"上杉", "北地区", #1972/7/3#, "B", 62, 134}, {"最上", "西地区", #1964/3/2#, "O", 72, 180}, {"片倉", "南地区", #1972/8/8#, "A", 66, 163}, {"田村", "東地区", #1986/2/2#, "A", 76, 176}, {"津軽", "北地区", #1993/2/15#, "AB", 68, 145} } worksheet.Range("A1:F7").Value = data worksheet.Columns(2).AutoFit() ' データバールールを設定 Dim dataBar As IDataBar = worksheet.Range("E2:E7").FormatConditions.AddDatabar() dataBar.MinPoint.Type = ConditionValueTypes.LowestValue dataBar.MinPoint.Value = Nothing dataBar.MaxPoint.Type = ConditionValueTypes.HighestValue dataBar.MaxPoint.Value = Nothing dataBar.BarFillType = DataBarFillType.Gradient dataBar.BarColor.Color = Color.Green dataBar.Direction = DataBarDirection.Context dataBar.AxisColor.Color = Color.Red dataBar.AxisPosition = DataBarAxisPosition.Automatic dataBar.NegativeBarFormat.BorderColorType = DataBarNegativeColorType.Color dataBar.NegativeBarFormat.BorderColor.Color = Color.Blue dataBar.NegativeBarFormat.ColorType = DataBarNegativeColorType.Color dataBar.NegativeBarFormat.Color.Color = Color.Pink dataBar.ShowValue = False ' xlsx ファイルに保存 workbook.Save("CreateDatabBarRule.xlsx")