VB-Report 10.0 for .NET - ASP.NET MVC デモ
セルの書式設定
コード上からセルの書式設定を行うことができます。
サンプルコード
- VB.NET
- C#
- Public Function DataCellAttribute() As ReportDataCellReport1.Report.Start(ReportMode.Speed)' 帳票作成処理(新規)CellReport1.Report.Create(ExcelVersion.ver2007)' 帳票ページを作成CellReport1.Page.Start("表示形式", "1-999")' 値の設定CellReport1.Cell("A").ColWidth = 24CellReport1.Cell("B").ColWidth = 20CellReport1.Cell("A1").Attr.FontPoint = 14CellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.BoldCellReport1.Cell("A1").Str = "表示形式の設定"' 表示形式を設定' 標準CellReport1.Cell("A2").Str = "標準"CellReport1.Cell("B2").Attr.Format = "G/標準"CellReport1.Cell("B2").Str = "VB-Report 10.0 for .NET"' 数値CellReport1.Cell("A3").Str = "数値(桁区切りを使用する)"CellReport1.Cell("B3").Attr.Format = "#,##0_ "CellReport1.Cell("B3").Value = 1000000000' 通貨CellReport1.Cell("A4").Str = "通貨(記号¥)"CellReport1.Cell("B4").Attr.Format = """\""#,##0""\""-#,##0"CellReport1.Cell("B4").Value = 1000000' 日付CellReport1.Cell("A5").Str = "日付(yyyy/m/d)"CellReport1.Cell("B5").Attr.Format = "yyyy/m/d"CellReport1.Cell("B5").Value = Convert.ToDateTime(DateTime.Today).ToOADate()' パーセンテージCellReport1.Cell("A6").Str = "パーセンテージ"CellReport1.Cell("B6").Attr.Format = "0%"CellReport1.Cell("B6").Value = 0.5' ユーザー定義 1CellReport1.Cell("A7").Str = "値がマイナスの時に赤色"CellReport1.Cell("B7").Attr.Format = "#.#0[赤]-#.#0"CellReport1.Cell("B7").Value = -123456' ユーザー定義 2CellReport1.Cell("A8").Str = "値が0の時にZERO "CellReport1.Cell("B8").Attr.Format = """ZERO"""CellReport1.Cell("B8").Value = 0CellReport1.Page.End()' 帳票ページを作成CellReport1.Page.Start("配置(文字の配置)", "1-999")' 値の設定CellReport1.Page.Attr.Size(PageOrientation.Landscape, 100, PaperKind.A4)CellReport1.Cell("A1").Attr.FontPoint = 14CellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.BoldCellReport1.Cell("A1").Str = "文字の配置の設定"CellReport1.Cell("B1").Str = "(x 軸→縦位置、y 軸→横位置)"CellReport1.Cell("A2:F9").RowHeight = 40CellReport1.Cell("A2:F9").ColWidth = 20CellReport1.Cell("B2:F2").Attr.FontStyle = VBReport.FontStyle.BoldCellReport1.Cell("A2:A9").Attr.FontStyle = VBReport.FontStyle.BoldCellReport1.Cell("A2:F9").Attr.Box(BoxType.Ltc, BorderStyle.Thin, xlColor.Black)' [配置] - [縦位置] を設定' 文字の配置を確認するための文字列を設定CellReport1.Pos(1, 2, 5, 8).Str = "あいうえお"' 縦位置CellReport1.Cell("B2").Str = "上詰め"CellReport1.Cell("B3:B11").Attr.VerticalAlignment = VerticalAlignment.TopCellReport1.Cell("C2").Str = "中央揃え"CellReport1.Cell("C3:C11").Attr.VerticalAlignment = VerticalAlignment.CenterCellReport1.Cell("D2").Str = "下詰め"CellReport1.Cell("D3:D11").Attr.VerticalAlignment = VerticalAlignment.BottomCellReport1.Cell("E2").Str = "両端揃え"CellReport1.Cell("E3:E11").Attr.VerticalAlignment = VerticalAlignment.JustifyCellReport1.Cell("F2").Str = "均等割付"CellReport1.Cell("F3:F11").Attr.VerticalAlignment = VerticalAlignment.Distributed' [配置] - [横位置] を設定' 横位置CellReport1.Cell("A3").Str = "標準"CellReport1.Cell("B3:F3").Attr.HorizontalAlignment = HorizontalAlignment.GeneralCellReport1.Cell("A4").Str = "左詰め"CellReport1.Cell("B4:F4").Attr.HorizontalAlignment = HorizontalAlignment.LeftCellReport1.Cell("A5").Str = "中央揃え"CellReport1.Cell("B5:F5").Attr.HorizontalAlignment = HorizontalAlignment.CenterCellReport1.Cell("A6").Str = "右詰め"CellReport1.Cell("B6:F6").Attr.HorizontalAlignment = HorizontalAlignment.RightCellReport1.Cell("A7").Str = "両端揃え"CellReport1.Cell("B7:F7").Attr.HorizontalAlignment = HorizontalAlignment.JustifyCellReport1.Cell("A8").Str = "選択範囲内で中央"CellReport1.Cell("B8:F8").Attr.HorizontalAlignment = HorizontalAlignment.CenterContinuousCellReport1.Cell("A9").Str = "均等割付"CellReport1.Cell("B9:F9").Attr.HorizontalAlignment = HorizontalAlignment.DistributedCellReport1.Page.End()' 帳票ページを作成CellReport1.Page.Start("配置(方向)", "1-999")' 値の設定CellReport1.Page.Attr.Size(PageOrientation.Landscape, 100, PaperKind.A4)CellReport1.Cell("A1").Attr.FontPoint = 14CellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.BoldCellReport1.Cell("A1").Str = "方向の設定"CellReport1.Cell("A:F").ColWidth = 16.5CellReport1.Cell("A2").RowHeight = 120CellReport1.Cell("A4").RowHeight = 80' [配置] - [方向] を設定' 設定値は Orientation 列挙体の定数か -90 度~ 90 度の値が設定可能' 定数CellReport1.Cell("A2").Attr.Orientation = Orientation.HorzCellReport1.Cell("A2").Str = "横方向"CellReport1.Cell("B2").Attr.Orientation = Orientation.VertCellReport1.Cell("B2").Str = "縦方向"CellReport1.Cell("C2").Attr.Orientation = Orientation.RvTurn90CellReport1.Cell("C2").Str = "反時計回りに 90 度"CellReport1.Cell("D2").Attr.Orientation = Orientation.Turn90CellReport1.Cell("D2").Str = "時計回りに 90 度"' 値CellReport1.Cell("A4").Attr.Orientation = 30CellReport1.Cell("A4").Str = "値で指定(30度)"CellReport1.Cell("B4").Attr.Orientation = (-30)CellReport1.Cell("B4").Str = "値で指定(-30度)"CellReport1.Cell("C4").Attr.Orientation = 45CellReport1.Cell("C4").Str = "値で指定(45度)"CellReport1.Cell("D4").Attr.Orientation = (-45)CellReport1.Cell("D4").Str = "値で指定(-45度)"CellReport1.Cell("E4").Attr.Orientation = 60CellReport1.Cell("E4").Str = "値で指定(60度)"CellReport1.Cell("F4").Attr.Orientation = (-60)CellReport1.Cell("F4").Str = "値で指定(-60度)"CellReport1.Page.End()' 帳票ページを作成CellReport1.Page.Start("配置(文字の制御)", "1-999")' 値の設定CellReport1.Cell("A1").Attr.FontPoint = 14CellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.BoldCellReport1.Cell("A1").Str = "文字の制御の設定"CellReport1.Cell("A").ColWidth = 16' [配置] - [折り返して全体を表示する] を設定CellReport1.Cell("A2").Str = "折り返し(ON)"CellReport1.Cell("B2").Attr.WrapText = TrueCellReport1.Cell("B2").RowHeight = 41CellReport1.Cell("B2").Str = "abcdefghijklmnopqrstuvwxyz"CellReport1.Cell("A3").Str = "折り返し(OFF)"CellReport1.Cell("B3").Attr.WrapText = FalseCellReport1.Cell("B3").Str = "abcdefghijklmnopqrstuvwxyz"' [配置] - [縮小して全体を表示する] を設定CellReport1.Cell("A5").Str = "縮小(ON)"CellReport1.Cell("B5").Attr.ShrinkToFit = TrueCellReport1.Cell("B5").Str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"CellReport1.Cell("A6").Str = "縮小(OFF)"CellReport1.Cell("B6").Attr.ShrinkToFit = FalseCellReport1.Cell("B6").Str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"' [配置] - [セルを結合する] を設定CellReport1.Cell("A8").Str = "B8:C8 セルを結合"CellReport1.Cell("B8:C8").Attr.MergeCells = TrueCellReport1.Cell("B8:C8").Value = 1234567890CellReport1.Cell("B8:C8").Attr.Box(BoxType.Ltc, BorderStyle.Thin, xlColor.Black)CellReport1.Page.End()' 帳票ページを作成CellReport1.Page.Start("フォント", "1-999")' 値の設定CellReport1.Page.Attr.Size(PageOrientation.Landscape, 100, PaperKind.A4)CellReport1.Cell("A1").Attr.FontPoint = 14CellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.BoldCellReport1.Cell("A1").Str = "フォントの設定" + "(Xlsx形式)"CellReport1.Cell("A").ColWidth = 18CellReport1.Cell("B:D").ColWidth = 33' フォントの種類、フォントサイズを設定CellReport1.Cell("A2").Str = "フォント名(サイズ)"CellReport1.Cell("B2:B4").Attr.FontName = "MS P明朝"CellReport1.Cell("B2").Attr.FontPoint = 8CellReport1.Cell("B2").Str = "MS P明朝(8)"CellReport1.Cell("B3").Attr.FontPoint = 11CellReport1.Cell("B3").Str = "MS P明朝(11)"CellReport1.Cell("B4").Attr.FontPoint = 20CellReport1.Cell("B4").Str = "MS P明朝(20)"CellReport1.Cell("B4").RowHeight = 26CellReport1.Cell("C2:C4").Attr.FontName = "MS ゴシック"CellReport1.Cell("C2").Attr.FontPoint = 8CellReport1.Cell("C2").Str = "MS ゴシック(8)"CellReport1.Cell("C3").Attr.FontPoint = 11CellReport1.Cell("C3").Str = "MS ゴシック(11)"CellReport1.Cell("C4").Attr.FontPoint = 20CellReport1.Cell("C4").Str = "MS ゴシック(20)"CellReport1.Cell("D2:D4").Attr.FontName = "Meiryo"CellReport1.Cell("D2").Attr.FontPoint = 8CellReport1.Cell("D2").Str = "Meiryo (8)"CellReport1.Cell("D3").Attr.FontPoint = 11CellReport1.Cell("D3").Str = "Meiryo (11)"CellReport1.Cell("D4").Attr.FontPoint = 20CellReport1.Cell("D4").Str = "Meiryo (20)"CellReport1.Cell("E2:E4").Attr.FontName = "Arial"CellReport1.Cell("E2").Attr.FontPoint = 8CellReport1.Cell("E2").Str = "Arial (8)"CellReport1.Cell("E3").Attr.FontPoint = 11CellReport1.Cell("E3").Str = "Arial (11)"CellReport1.Cell("E4").Attr.FontPoint = 20CellReport1.Cell("E4").Str = "Arial (20)"' フォントのスタイル、文字飾りを設定CellReport1.Cell("A6").Str = "スタイル、文字飾り"CellReport1.Cell("B6").Attr.FontStyle = VBReport.FontStyle.NormalCellReport1.Cell("B6").Str = "標準"CellReport1.Cell("C6").Attr.FontStyle = VBReport.FontStyle.ItalicCellReport1.Cell("C6").Str = "斜体"CellReport1.Cell("D6").Attr.FontStyle = VBReport.FontStyle.BoldCellReport1.Cell("D6").Str = "太字"CellReport1.Cell("B7").Attr.FontStyle = VBReport.FontStyle.Bold Or VBReport.FontStyle.ItalicCellReport1.Cell("B7").Str = "太字 斜体"CellReport1.Cell("B8").Attr.FontStyle = VBReport.FontStyle.StrikeCellReport1.Cell("B8").Str = "取り消し線"CellReport1.Cell("C8").Attr.FontStyle = VBReport.FontStyle.UpCellReport1.Cell("C8").Str = "上付き"CellReport1.Cell("D8").Attr.FontStyle = VBReport.FontStyle.DownCellReport1.Cell("D8").Str = "下付き"' フォントの下線を設定CellReport1.Cell("A10").Str = "下線"CellReport1.Cell("B10").Attr.FontULine = FontULine.NormalCellReport1.Cell("B10").Str = "下線"CellReport1.Cell("C10").Attr.FontULine = FontULine.DoubleCellReport1.Cell("C10").Str = "二重下線"' xls 形式の色定数(xlColor 列挙体)による文字色を設定' xlsx 形式の帳票出力でも設定が可能CellReport1.Cell("A12").Str = "色(定数)"CellReport1.Cell("B13").Attr.FontColor2 = xlColor.RedCellReport1.Cell("B13").Str = "赤(xlColor.Red)"CellReport1.Cell("C13").Attr.FontColor2 = xlColor.GreenCellReport1.Cell("C13").Str = "緑(xlColor.Green)"CellReport1.Cell("D13").Attr.FontColor2 = xlColor.BlueCellReport1.Cell("D13").Str = "青(xlColor.Blue)"CellReport1.Cell("B14").Attr.FontColor2 = xlColor.PurpleCellReport1.Cell("B14").Str = "紫(xlColor.Purple)"CellReport1.Cell("C14").Attr.FontColor2 = xlColor.GrayCellReport1.Cell("C14").Str = "グレー(xlColor.Gray)"CellReport1.Cell("D14").Attr.FontColor2 = xlColor.OrangeCellReport1.Cell("D14").Str = "オレンジ(xlColor.Orange)"' RGB 値(System.Drawing.Color 構造体)による文字色を設定' xls 形式の帳票出力では設定が無効CellReport1.Cell("A16").Str = "色(RGB)"CellReport1.Cell("B16").Str = "※ xlsx 形式での設定時のみ使用可能です。"CellReport1.Cell("b16").Attr.FontStyle = VBReport.FontStyle.BoldCellReport1.Cell("B17").Attr.FontColor = Color.FromArgb(255, 0, 0)CellReport1.Cell("B17").Str = "赤(255, 0, 0)"CellReport1.Cell("C17").Attr.FontColor = Color.FromArgb(0, 255, 0)CellReport1.Cell("C17").Str = "緑(0, 255, 0)"CellReport1.Cell("D17").Attr.FontColor = Color.FromArgb(0, 0, 255)CellReport1.Cell("D17").Str = "青(0, 0, 255)"CellReport1.Cell("B18").Attr.FontColor = Color.FromArgb(128, 0, 128)CellReport1.Cell("B18").Str = "紫(128, 0, 128)"CellReport1.Cell("C18").Attr.FontColor = Color.FromArgb(153, 153, 255)CellReport1.Cell("C18").Str = "グレー(153, 153, 255)"CellReport1.Cell("D18").Attr.FontColor = Color.FromArgb(255, 102, 0)CellReport1.Cell("D18").Str = "オレンジ(255, 102, 0)"CellReport1.Page.End()' 帳票ページを作成CellReport1.Page.Start("罫線", "1-999")' 値の設定CellReport1.Cell("A1").Attr.FontPoint = 14CellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.BoldCellReport1.Cell("A1").Str = "罫線の設定" + "(Xlsx形式)"CellReport1.Cell("A2").Str = "※色の指定には RGB 値と色定数がありますが、RGB 値の指定は xlsx 形式での設定時のみ使用可能です。"CellReport1.Cell("A2").Attr.FontColor2 = xlColor.RedCellReport1.Cell("B").ColWidth = 18CellReport1.Cell("D").ColWidth = 18CellReport1.Cell("F").ColWidth = 18' 各方向の罫線と線種を設定CellReport1.Cell("B3").Str = "実線"CellReport1.Cell("B3").Attr.LineLeft(BorderStyle.Thin, xlColor.Black)CellReport1.Cell("B3").Attr.LineTop(BorderStyle.Thin, xlColor.Black)CellReport1.Cell("B3").Attr.LineRight(BorderStyle.Thin, xlColor.Black)CellReport1.Cell("B3").Attr.LineBottom(BorderStyle.Thin, xlColor.Black)CellReport1.Cell("D3").Str = "太線"CellReport1.Cell("D3").Attr.LineLeft(BorderStyle.Medium, xlColor.Black)CellReport1.Cell("D3").Attr.LineTop(BorderStyle.Medium, xlColor.Black)CellReport1.Cell("D3").Attr.LineRight(BorderStyle.Medium, xlColor.Black)CellReport1.Cell("D3").Attr.LineBottom(BorderStyle.Medium, xlColor.Black)CellReport1.Cell("F3").Str = "破線"CellReport1.Cell("F3").Attr.LineLeft(BorderStyle.Dashed, xlColor.Black)CellReport1.Cell("F3").Attr.LineTop(BorderStyle.Dashed, xlColor.Black)CellReport1.Cell("F3").Attr.LineRight(BorderStyle.Dashed, xlColor.Black)CellReport1.Cell("F3").Attr.LineBottom(BorderStyle.Dashed, xlColor.Black)CellReport1.Cell("B5").Str = "点線"CellReport1.Cell("B5").Attr.LineLeft(BorderStyle.Dotted, xlColor.Black)CellReport1.Cell("B5").Attr.LineTop(BorderStyle.Dotted, xlColor.Black)CellReport1.Cell("B5").Attr.LineRight(BorderStyle.Dotted, xlColor.Black)CellReport1.Cell("B5").Attr.LineBottom(BorderStyle.Dotted, xlColor.Black)CellReport1.Cell("D5").Str = "極太線"CellReport1.Cell("D5").Attr.LineLeft(BorderStyle.Thick, xlColor.Black)CellReport1.Cell("D5").Attr.LineTop(BorderStyle.Thick, xlColor.Black)CellReport1.Cell("D5").Attr.LineRight(BorderStyle.Thick, xlColor.Black)CellReport1.Cell("D5").Attr.LineBottom(BorderStyle.Thick, xlColor.Black)CellReport1.Cell("F5").Str = "二重線"CellReport1.Cell("F5").Attr.LineLeft(BorderStyle.Double, xlColor.Black)CellReport1.Cell("F5").Attr.LineTop(BorderStyle.Double, xlColor.Black)CellReport1.Cell("F5").Attr.LineRight(BorderStyle.Double, xlColor.Black)CellReport1.Cell("F5").Attr.LineBottom(BorderStyle.Double, xlColor.Black)CellReport1.Cell("B7").Str = "細実線"CellReport1.Cell("B7").Attr.LineLeft(BorderStyle.Hair, xlColor.Black)CellReport1.Cell("B7").Attr.LineTop(BorderStyle.Hair, xlColor.Black)CellReport1.Cell("B7").Attr.LineRight(BorderStyle.Hair, xlColor.Black)CellReport1.Cell("B7").Attr.LineBottom(BorderStyle.Hair, xlColor.Black)CellReport1.Cell("D7").Str = "中破線"CellReport1.Cell("D7").Attr.LineLeft(BorderStyle.MediumDashed, xlColor.Black)CellReport1.Cell("D7").Attr.LineTop(BorderStyle.MediumDashed, xlColor.Black)CellReport1.Cell("D7").Attr.LineRight(BorderStyle.MediumDashed, xlColor.Black)CellReport1.Cell("D7").Attr.LineBottom(BorderStyle.MediumDashed, xlColor.Black)CellReport1.Cell("F7").Str = "細一点鎖線"CellReport1.Cell("F7").Attr.LineLeft(BorderStyle.DashDot, xlColor.Black)CellReport1.Cell("F7").Attr.LineTop(BorderStyle.DashDot, xlColor.Black)CellReport1.Cell("F7").Attr.LineRight(BorderStyle.DashDot, xlColor.Black)CellReport1.Cell("F7").Attr.LineBottom(BorderStyle.DashDot, xlColor.Black)CellReport1.Cell("B9").Str = "中一点鎖線"CellReport1.Cell("B9").Attr.LineLeft(BorderStyle.MediumDashDot, xlColor.Black)CellReport1.Cell("B9").Attr.LineTop(BorderStyle.MediumDashDot, xlColor.Black)CellReport1.Cell("B9").Attr.LineRight(BorderStyle.MediumDashDot, xlColor.Black)CellReport1.Cell("B9").Attr.LineBottom(BorderStyle.MediumDashDot, xlColor.Black)CellReport1.Cell("D9").Str = "細二点鎖線"CellReport1.Cell("D9").Attr.LineLeft(BorderStyle.DashDotDot, xlColor.Black)CellReport1.Cell("D9").Attr.LineTop(BorderStyle.DashDotDot, xlColor.Black)CellReport1.Cell("D9").Attr.LineRight(BorderStyle.DashDotDot, xlColor.Black)CellReport1.Cell("D9").Attr.LineBottom(BorderStyle.DashDotDot, xlColor.Black)CellReport1.Cell("F9").Str = "中二点鎖線"CellReport1.Cell("F9").Attr.LineLeft(BorderStyle.MediumDashDotDot, xlColor.Black)CellReport1.Cell("F9").Attr.LineTop(BorderStyle.MediumDashDotDot, xlColor.Black)CellReport1.Cell("F9").Attr.LineRight(BorderStyle.MediumDashDotDot, xlColor.Black)CellReport1.Cell("F9").Attr.LineBottom(BorderStyle.MediumDashDotDot, xlColor.Black)CellReport1.Cell("B11").Str = "中一点斜鎖線"CellReport1.Cell("B11").Attr.LineLeft(BorderStyle.SlantDashDot, xlColor.Black)CellReport1.Cell("B11").Attr.LineTop(BorderStyle.SlantDashDot, xlColor.Black)CellReport1.Cell("B11").Attr.LineRight(BorderStyle.SlantDashDot, xlColor.Black)CellReport1.Cell("B11").Attr.LineBottom(BorderStyle.SlantDashDot, xlColor.Black)' 各方向の罫線と線の色を指定' 色の指定には RGB 値と色定数(xlColor 列挙体)がありますが、RGB 値の指定は xlsx 形式でのみ可能CellReport1.Cell("B13").Str = "実線(赤)"CellReport1.Cell("B13").Attr.LineLeft(BorderStyle.Thin, xlColor.Red)CellReport1.Cell("B13").Attr.LineTop(BorderStyle.Thin, xlColor.Red)CellReport1.Cell("B13").Attr.LineRight(BorderStyle.Thin, xlColor.Red)CellReport1.Cell("B13").Attr.LineBottom(BorderStyle.Thin, xlColor.Red)CellReport1.Cell("D13").Str = "太線(緑)"CellReport1.Cell("D13").Attr.LineLeft(BorderStyle.Medium, xlColor.Green)CellReport1.Cell("D13").Attr.LineTop(BorderStyle.Medium, xlColor.Green)CellReport1.Cell("D13").Attr.LineRight(BorderStyle.Medium, xlColor.Green)CellReport1.Cell("D13").Attr.LineBottom(BorderStyle.Medium, xlColor.Green)CellReport1.Cell("F13").Str = "破線(青)"CellReport1.Cell("F13").Attr.LineLeft(BorderStyle.Dashed, xlColor.Blue)CellReport1.Cell("F13").Attr.LineTop(BorderStyle.Dashed, xlColor.Blue)CellReport1.Cell("F13").Attr.LineRight(BorderStyle.Dashed, xlColor.Blue)CellReport1.Cell("F13").Attr.LineBottom(BorderStyle.Dashed, xlColor.Blue)CellReport1.Cell("B15").Str = "点線(紫)"CellReport1.Cell("B15").Attr.LineLeft(BorderStyle.Dotted, xlColor.Purple)CellReport1.Cell("B15").Attr.LineTop(BorderStyle.Dotted, xlColor.Purple)CellReport1.Cell("B15").Attr.LineRight(BorderStyle.Dotted, xlColor.Purple)CellReport1.Cell("B15").Attr.LineBottom(BorderStyle.Dotted, xlColor.Purple)CellReport1.Cell("D15").Str = "極太線(グレー)"CellReport1.Cell("D15").Attr.LineLeft(BorderStyle.Thick, xlColor.Gray)CellReport1.Cell("D15").Attr.LineTop(BorderStyle.Thick, xlColor.Gray)CellReport1.Cell("D15").Attr.LineRight(BorderStyle.Thick, xlColor.Gray)CellReport1.Cell("D15").Attr.LineBottom(BorderStyle.Thick, xlColor.Gray)CellReport1.Cell("F15").Str = "二重線(オレンジ)"CellReport1.Cell("F15").Attr.LineLeft(BorderStyle.Double, xlColor.Orange)CellReport1.Cell("F15").Attr.LineTop(BorderStyle.Double, xlColor.Orange)CellReport1.Cell("F15").Attr.LineRight(BorderStyle.Double, xlColor.Orange)CellReport1.Cell("F15").Attr.LineBottom(BorderStyle.Double, xlColor.Orange)' 左上がり斜線、右上がり斜線CellReport1.Cell("B17").Attr.LineLeftUp(BorderStyle.Thin, xlColor.Black)CellReport1.Cell("D17").Attr.LineRightUp(BorderStyle.Medium, xlColor.Black)CellReport1.Cell("F17").Attr.LineLeftUp(BorderStyle.Dashed, xlColor.Black)CellReport1.Cell("B19").Attr.LineRightUp(BorderStyle.Dotted, xlColor.Black)CellReport1.Cell("D19").Attr.LineLeftUp(BorderStyle.Thick, xlColor.Black)CellReport1.Cell("F19").Attr.LineRightUp(BorderStyle.Double, xlColor.Black)CellReport1.Cell("B21").Attr.LineLeftUp(BorderStyle.Hair, xlColor.Black)CellReport1.Cell("D21").Attr.LineRightUp(BorderStyle.MediumDashed, xlColor.Black)CellReport1.Cell("F21").Attr.LineLeftUp(BorderStyle.DashDot, xlColor.Black)CellReport1.Cell("B23").Attr.LineRightUp(BorderStyle.MediumDashDot, xlColor.Black)CellReport1.Cell("D23").Attr.LineLeftUp(BorderStyle.DashDotDot, xlColor.Black)CellReport1.Cell("F23").Attr.LineRightUp(BorderStyle.MediumDashDotDot, xlColor.Black)CellReport1.Cell("B25").Attr.LineLeftUp(BorderStyle.SlantDashDot, xlColor.Black)' 左上がり斜線(色)、右上がり斜線(色)CellReport1.Cell("B27").Attr.LineLeftUp(BorderStyle.Thin, xlColor.Red)CellReport1.Cell("D27").Attr.LineRightUp(BorderStyle.Medium, xlColor.Green)CellReport1.Cell("F27").Attr.LineLeftUp(BorderStyle.Dashed, xlColor.Blue)CellReport1.Cell("B29").Attr.LineRightUp(BorderStyle.Dotted, xlColor.Purple)CellReport1.Cell("D29").Attr.LineLeftUp(BorderStyle.Thick, xlColor.Gray)CellReport1.Cell("F29").Attr.LineRightUp(BorderStyle.Double, xlColor.Orange)' Box 罫線を設定' 引数については罫線設定の機能と同様CellReport1.Cell("B31").Str = "箱線(実線)"CellReport1.Cell("B31").Attr.Box(BoxType.Box, BorderStyle.Thin, xlColor.Black)CellReport1.Cell("D31").Str = "上横線(太線)"CellReport1.Cell("D31").Attr.Box(BoxType.Over, BorderStyle.Medium, xlColor.Black)CellReport1.Cell("F31").Str = "下横線(破線)"CellReport1.Cell("F31").Attr.Box(BoxType.Under, BorderStyle.Dashed, xlColor.Black)CellReport1.Cell("B33").Str = "左縦線(点線)"CellReport1.Cell("B33").Attr.Box(BoxType.Left, BorderStyle.Dotted, xlColor.Black)CellReport1.Cell("D33").Str = "右縦線(極太線)"CellReport1.Cell("D33").Attr.Box(BoxType.Right, BorderStyle.Thick, xlColor.Black)CellReport1.Cell("B35").Str = "格子線(赤二重線)"CellReport1.Cell("B35:F37").Attr.Box(BoxType.Ltc, BorderStyle.Double, xlColor.Red)CellReport1.Page.End()' 帳票ページを作成CellReport1.Page.Start("塗りつぶし(背景色)", "1-999")' 値の設定CellReport1.Page.Attr.Size(PageOrientation.Landscape, 100, PaperKind.A4)CellReport1.Cell("A1").Attr.FontPoint = 14CellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.BoldCellReport1.Cell("A1").Str = "背景色の設定" + "(Xlsx形式)"' xls 形式の色定数(xlColor 列挙体)による文字色を設定' xlsx 形式の帳票出力でも設定が可能CellReport1.Cell("A3").Str = "書式設定の定数"CellReport1.Cell("B4").Attr.BackColor2 = xlColor.Black ' 黒
CellReport1.Cell("D4").Attr.BackColor2 = xlColor.White ' 白
CellReport1.Cell("F4").Attr.BackColor2 = xlColor.Red ' 赤
CellReport1.Cell("H4").Attr.BackColor2 = xlColor.Green ' 緑
CellReport1.Cell("J4").Attr.BackColor2 = xlColor.Blue ' 青
CellReport1.Cell("L4").Attr.BackColor2 = xlColor.Yellow ' 黄
CellReport1.Cell("N4").Attr.BackColor2 = xlColor.Pink ' ピンク
CellReport1.Cell("B6").Attr.BackColor2 = xlColor.Cyan ' 水
CellReport1.Cell("D6").Attr.BackColor2 = xlColor.DarkRed ' 濃い赤
CellReport1.Cell("F6").Attr.BackColor2 = xlColor.DarkGreen ' 濃い緑
CellReport1.Cell("H6").Attr.BackColor2 = xlColor.DrakBlue ' 濃い青
CellReport1.Cell("J6").Attr.BackColor2 = xlColor.DrakYellow ' 濃い黄
CellReport1.Cell("L6").Attr.BackColor2 = xlColor.Purple ' 紫
CellReport1.Cell("N6").Attr.BackColor2 = xlColor.BlueGreen ' 青緑
CellReport1.Cell("B8").Attr.BackColor2 = xlColor.Gray25 ' 25%灰色
CellReport1.Cell("D8").Attr.BackColor2 = xlColor.Gray50 ' 50%灰色
CellReport1.Cell("F8").Attr.BackColor2 = xlColor.Gray ' グレー
CellReport1.Cell("H8").Attr.BackColor2 = xlColor.Plum ' プラム
CellReport1.Cell("J8").Attr.BackColor2 = xlColor.Ivory ' アイボリー
CellReport1.Cell("L8").Attr.BackColor2 = xlColor.LightBlue ' 薄い水色
CellReport1.Cell("N8").Attr.BackColor2 = xlColor.DrakPurple ' 濃い紫
CellReport1.Cell("B10").Attr.BackColor2 = xlColor.Coral ' コーラル
CellReport1.Cell("D10").Attr.BackColor2 = xlColor.OceanBlue ' オーシャンブルー
CellReport1.Cell("F10").Attr.BackColor2 = xlColor.IceBlue ' アイスブルー
CellReport1.Cell("H10").Attr.BackColor2 = xlColor.DrakBlue2 ' 濃い青
CellReport1.Cell("J10").Attr.BackColor2 = xlColor.Pink2 ' ピンク
CellReport1.Cell("L10").Attr.BackColor2 = xlColor.Yellow2 ' 黄色
CellReport1.Cell("N10").Attr.BackColor2 = xlColor.Cyan2 ' 水色' RGB 値(System.Drawing.Color 構造体)による文字色を設定' xls 形式の帳票出力では設定が無効CellReport1.Cell("A11").Str = "RGB 値"CellReport1.Cell("B11").Str = "※ xlsx 形式での設定時のみ使用可能です。"CellReport1.Cell("B11").Attr.FontColor2 = xlColor.RedCellReport1.Cell("B12").Attr.BackColor = Color.FromArgb(128, 0, 128) ' 紫
CellReport1.Cell("D12").Attr.BackColor = Color.FromArgb(128, 0, 0) ' 濃い赤
CellReport1.Cell("F12").Attr.BackColor = Color.FromArgb(0, 128, 128) ' 青緑
CellReport1.Cell("H12").Attr.BackColor = Color.FromArgb(0, 0, 255) ' 青
CellReport1.Cell("J12").Attr.BackColor = Color.FromArgb(0, 204, 255) ' スカイブルー
CellReport1.Cell("L12").Attr.BackColor = Color.FromArgb(204, 255, 255) ' 薄い水色
CellReport1.Cell("N11").Attr.BackColor = Color.FromArgb(204, 255, 204) ' 薄い緑
CellReport1.Cell("B14").Attr.BackColor = Color.FromArgb(255, 255, 153) ' 薄い黄色
CellReport1.Cell("D14").Attr.BackColor = Color.FromArgb(153, 204, 255) ' ベールブルー
CellReport1.Cell("F14").Attr.BackColor = Color.FromArgb(255, 153, 204) ' ローズ
CellReport1.Cell("H14").Attr.BackColor = Color.FromArgb(204, 153, 255) ' ラベンダー
CellReport1.Cell("J14").Attr.BackColor = Color.FromArgb(255, 204, 153) ' ベージュ
CellReport1.Cell("L14").Attr.BackColor = Color.FromArgb(51, 102, 255) ' 薄い青
CellReport1.Cell("N14").Attr.BackColor = Color.FromArgb(51, 204, 204) ' アクア
CellReport1.Cell("B16").Attr.BackColor = Color.FromArgb(153, 204, 0) ' ライム
CellReport1.Cell("D16").Attr.BackColor = Color.FromArgb(255, 204, 0) ' ゴールド
CellReport1.Cell("F16").Attr.BackColor = Color.FromArgb(255, 153, 0) ' 薄いオレンジ
CellReport1.Cell("H16").Attr.BackColor = Color.FromArgb(255, 102, 0) ' オレンジ
CellReport1.Cell("J16").Attr.BackColor = Color.FromArgb(102, 102, 153) ' ブルーグレー
CellReport1.Cell("L16").Attr.BackColor = Color.FromArgb(150, 150, 150) ' 40%灰色
CellReport1.Cell("N16").Attr.BackColor = Color.FromArgb(0, 51, 102) ' 濃い青緑
CellReport1.Cell("B18").Attr.BackColor = Color.FromArgb(51, 153, 102) ' シーグリーン
CellReport1.Cell("D18").Attr.BackColor = Color.FromArgb(0, 51, 0) ' 濃い緑
CellReport1.Cell("F18").Attr.BackColor = Color.FromArgb(51, 51, 0) ' オリーブ
CellReport1.Cell("H18").Attr.BackColor = Color.FromArgb(153, 51, 0) ' 茶
CellReport1.Cell("J18").Attr.BackColor = Color.FromArgb(153, 51, 102) ' プラム
CellReport1.Cell("L18").Attr.BackColor = Color.FromArgb(51, 51, 153) ' インディゴ
CellReport1.Cell("N18").Attr.BackColor = Color.FromArgb(51, 51, 51) ' 80%灰色CellReport1.Page.End()' 帳票ページを作成CellReport1.Page.Start("塗りつぶし(パターン)", "1-999")' 値の設定CellReport1.Page.Attr.Size(PageOrientation.Landscape, 100, PaperKind.A4)CellReport1.Cell("A1").Attr.FontPoint = 14CellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.BoldCellReport1.Cell("A1").Str = "パターンの設定" + "(Xlsx形式)"CellReport1.Cell("A").ColWidth = 18' [パターン] を設定CellReport1.Cell("A3").Str = "パターン"CellReport1.Cell("B3").Attr.Pattern = Pattern.SolidCellReport1.Cell("D3").Attr.Pattern = Pattern.MediumGrayCellReport1.Cell("F3").Attr.Pattern = Pattern.DarkGrayCellReport1.Cell("H3").Attr.Pattern = Pattern.LightGrayCellReport1.Cell("J3").Attr.Pattern = Pattern.DarkHorizontalCellReport1.Cell("L3").Attr.Pattern = Pattern.DarkVerticalCellReport1.Cell("B5").Attr.Pattern = Pattern.DarkDownCellReport1.Cell("D5").Attr.Pattern = Pattern.DarkUpCellReport1.Cell("F5").Attr.Pattern = Pattern.DarkGridCellReport1.Cell("H5").Attr.Pattern = Pattern.DarkTrellisCellReport1.Cell("J5").Attr.Pattern = Pattern.LightHorizontalCellReport1.Cell("L5").Attr.Pattern = Pattern.LightVerticalCellReport1.Cell("B7").Attr.Pattern = Pattern.LightDownCellReport1.Cell("D7").Attr.Pattern = Pattern.LightUpCellReport1.Cell("F7").Attr.Pattern = Pattern.LightGridCellReport1.Cell("H7").Attr.Pattern = Pattern.LightTrellisCellReport1.Cell("J7").Attr.Pattern = Pattern.Gray125CellReport1.Cell("L7").Attr.Pattern = Pattern.Gray0625' [パターン] の色を設定' ForeColor2 で xls 形式の色定数(xlColor列挙体)、ForeColor で RGB 値(System.Drawing.Color 構造体)での指定が可能' ForeColor は xlsx 形式でのみ有効' パターン(色)CellReport1.Cell("A9").Str = "パターン(色)"CellReport1.Cell("B9").Str = "※左 3 列は色定数、右 3 列は RGB 値(xlsx 形式でのみ対応)"CellReport1.Cell("B9").Attr.FontColor2 = xlColor.RedCellReport1.Cell("B10").Attr.Pattern = Pattern.LightDownCellReport1.Cell("B10").Attr.ForeColor2 = xlColor.RedCellReport1.Cell("D10").Attr.Pattern = Pattern.MediumGrayCellReport1.Cell("D10").Attr.ForeColor2 = xlColor.GreenCellReport1.Cell("F10").Attr.Pattern = Pattern.DarkGrayCellReport1.Cell("F10").Attr.ForeColor2 = xlColor.BlueCellReport1.Cell("H10").Attr.Pattern = Pattern.LightGrayCellReport1.Cell("H10").Attr.ForeColor = Color.FromArgb(255, 0, 0)CellReport1.Cell("J10").Attr.Pattern = Pattern.DarkHorizontalCellReport1.Cell("J10").Attr.ForeColor = Color.FromArgb(0, 255, 0)CellReport1.Cell("L10").Attr.Pattern = Pattern.DarkVerticalCellReport1.Cell("L10").Attr.ForeColor = Color.FromArgb(0, 0, 255)' パターン+背景色CellReport1.Cell("A11").Str = "パターン+背景色"CellReport1.Cell("B11").Str = "※左 3 列は色定数、右 3 列は RGB 値(xlsx 形式でのみ対応)"CellReport1.Cell("B11").Attr.FontColor2 = xlColor.RedCellReport1.Cell("B12").Attr.Pattern = Pattern.DarkDownCellReport1.Cell("B12").Attr.ForeColor2 = xlColor.WhiteCellReport1.Cell("B12").Attr.BackColor2 = xlColor.BlackCellReport1.Cell("D12").Attr.Pattern = Pattern.DarkUpCellReport1.Cell("D12").Attr.ForeColor2 = xlColor.BlackCellReport1.Cell("D12").Attr.BackColor2 = xlColor.WhiteCellReport1.Cell("F12").Attr.Pattern = Pattern.DarkGridCellReport1.Cell("F12").Attr.ForeColor2 = xlColor.RedCellReport1.Cell("F12").Attr.BackColor2 = xlColor.WhiteCellReport1.Cell("H12").Attr.Pattern = Pattern.DarkTrellisCellReport1.Cell("H12").Attr.ForeColor = Color.FromArgb(0, 255, 0)CellReport1.Cell("H12").Attr.BackColor = Color.FromArgb(0, 0, 255)CellReport1.Cell("J12").Attr.Pattern = Pattern.LightHorizontalCellReport1.Cell("J12").Attr.ForeColor = Color.FromArgb(0, 0, 0)CellReport1.Cell("J12").Attr.BackColor = Color.FromArgb(255, 255, 255)CellReport1.Cell("L12").Attr.Pattern = Pattern.LightVerticalCellReport1.Cell("L12").Attr.ForeColor = Color.FromArgb(255, 0, 0)CellReport1.Cell("L12").Attr.BackColor = Color.FromArgb(255, 255, 255)CellReport1.Page.End()' 帳票終了処理CellReport1.Report.End()' 作成した帳票を SVG 形式で取得Dim document As String = CellReport1.Report.GetSvgReport(SvgSaveType.IncludeExcelPdf)Dim reportData As ReportData = New ReportData()reportData.Document = documentReturn reportDataEnd Function - public ReportData DataCellAttribute(){cellReport1.Report.Start(ReportMode.Speed);// 帳票作成処理(新規)cellReport1.Report.Create(ExcelVersion.ver2007);// 帳票ページを作成cellReport1.Page.Start("表示形式", "1-999");// 値の設定cellReport1.Cell("A").ColWidth = 24;cellReport1.Cell("B").ColWidth = 20;cellReport1.Cell("A1").Attr.FontPoint = 14;cellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.Bold;cellReport1.Cell("A1").Str = "表示形式の設定";// 表示形式を設定// 標準cellReport1.Cell("A2").Str = "標準";cellReport1.Cell("B2").Attr.Format = "G/標準";cellReport1.Cell("B2").Str = "VB-Report 10.0 for .NET";// 数値cellReport1.Cell("A3").Str = "数値(桁区切りを使用する)";cellReport1.Cell("B3").Attr.Format = "#,##0_ ";cellReport1.Cell("B3").Value = 1000000000;// 通貨cellReport1.Cell("A4").Str = "通貨(記号¥)";cellReport1.Cell("B4").Attr.Format = @"""\""#,##0;""\""-#,##0";cellReport1.Cell("B4").Value = 1000000;// 日付cellReport1.Cell("A5").Str = "日付(yyyy/m/d)";cellReport1.Cell("B5").Attr.Format = "yyyy/m/d";cellReport1.Cell("B5").Value = Convert.ToDateTime(DateTime.Today).ToOADate(); ;// パーセンテージcellReport1.Cell("A6").Str = "パーセンテージ";cellReport1.Cell("B6").Attr.Format = "0%";cellReport1.Cell("B6").Value = 0.5;// ユーザー定義 1cellReport1.Cell("A7").Str = "値がマイナスの時に赤色";cellReport1.Cell("B7").Attr.Format = "#.#0;[赤]-#.#0";cellReport1.Cell("B7").Value = -123456;// ユーザー定義 2cellReport1.Cell("A8").Str = "値が0の時にZERO ";cellReport1.Cell("B8").Attr.Format = @";;""ZERO""";cellReport1.Cell("B8").Value = 0;cellReport1.Page.End();// 帳票ページを作成cellReport1.Page.Start("配置(文字の配置)", "1-999");// 値の設定cellReport1.Page.Attr.Size(PageOrientation.Landscape, 100, PaperKind.A4);cellReport1.Cell("A1").Attr.FontPoint = 14;cellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.Bold;cellReport1.Cell("A1").Str = "文字の配置の設定";cellReport1.Cell("B1").Str = "(x 軸→縦位置、y 軸→横位置)";cellReport1.Cell("A2:F9").RowHeight = 40;cellReport1.Cell("A2:F9").ColWidth = 20;cellReport1.Cell("B2:F2").Attr.FontStyle = VBReport.FontStyle.Bold;cellReport1.Cell("A2:A9").Attr.FontStyle = VBReport.FontStyle.Bold;cellReport1.Cell("A2:F9").Attr.Box(BoxType.Ltc, BorderStyle.Thin, xlColor.Black);// [配置] - [縦位置] を設定// 文字の配置を確認するための文字列を設定cellReport1.Pos(1, 2, 5, 8).Str = "あいうえお";// 縦位置cellReport1.Cell("B2").Str = "上詰め";cellReport1.Cell("B3:B11").Attr.VerticalAlignment = VerticalAlignment.Top;cellReport1.Cell("C2").Str = "中央揃え";cellReport1.Cell("C3:C11").Attr.VerticalAlignment = VerticalAlignment.Center;cellReport1.Cell("D2").Str = "下詰め";cellReport1.Cell("D3:D11").Attr.VerticalAlignment = VerticalAlignment.Bottom;cellReport1.Cell("E2").Str = "両端揃え";cellReport1.Cell("E3:E11").Attr.VerticalAlignment = VerticalAlignment.Justify;cellReport1.Cell("F2").Str = "均等割付";cellReport1.Cell("F3:F11").Attr.VerticalAlignment = VerticalAlignment.Distributed;// [配置] - [横位置] を設定// 横位置cellReport1.Cell("A3").Str = "標準";cellReport1.Cell("B3:F3").Attr.HorizontalAlignment = HorizontalAlignment.General;cellReport1.Cell("A4").Str = "左詰め";cellReport1.Cell("B4:F4").Attr.HorizontalAlignment = HorizontalAlignment.Left;cellReport1.Cell("A5").Str = "中央揃え";cellReport1.Cell("B5:F5").Attr.HorizontalAlignment = HorizontalAlignment.Center;cellReport1.Cell("A6").Str = "右詰め";cellReport1.Cell("B6:F6").Attr.HorizontalAlignment = HorizontalAlignment.Right;cellReport1.Cell("A7").Str = "両端揃え";cellReport1.Cell("B7:F7").Attr.HorizontalAlignment = HorizontalAlignment.Justify;cellReport1.Cell("A8").Str = "選択範囲内で中央";cellReport1.Cell("B8:F8").Attr.HorizontalAlignment = HorizontalAlignment.CenterContinuous;cellReport1.Cell("A9").Str = "均等割付";cellReport1.Cell("B9:F9").Attr.HorizontalAlignment = HorizontalAlignment.Distributed;cellReport1.Page.End();// 帳票ページを作成cellReport1.Page.Start("配置(方向)", "1-999");// 値の設定cellReport1.Page.Attr.Size(PageOrientation.Landscape, 100, PaperKind.A4);cellReport1.Cell("A1").Attr.FontPoint = 14;cellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.Bold;cellReport1.Cell("A1").Str = "方向の設定";cellReport1.Cell("A:F").ColWidth = 16.5;cellReport1.Cell("A2").RowHeight = 120;cellReport1.Cell("A4").RowHeight = 80;// [配置] - [方向] を設定// 設定値は Orientation 列挙体の定数か -90 度~ 90 度の値が設定可能// 定数cellReport1.Cell("A2").Attr.Orientation = Orientation.Horz;cellReport1.Cell("A2").Str = "横方向";cellReport1.Cell("B2").Attr.Orientation = Orientation.Vert;cellReport1.Cell("B2").Str = "縦方向";cellReport1.Cell("C2").Attr.Orientation = Orientation.RvTurn90;cellReport1.Cell("C2").Str = "反時計回りに 90 度";cellReport1.Cell("D2").Attr.Orientation = Orientation.Turn90;cellReport1.Cell("D2").Str = "時計回りに 90 度";// 値cellReport1.Cell("A4").Attr.Orientation = (Orientation)30;cellReport1.Cell("A4").Str = "値で指定(30度)";cellReport1.Cell("B4").Attr.Orientation = (Orientation)(-30);cellReport1.Cell("B4").Str = "値で指定(-30度)";cellReport1.Cell("C4").Attr.Orientation = (Orientation)45;cellReport1.Cell("C4").Str = "値で指定(45度)";cellReport1.Cell("D4").Attr.Orientation = (Orientation)(-45);cellReport1.Cell("D4").Str = "値で指定(-45度)";cellReport1.Cell("E4").Attr.Orientation = (Orientation)60;cellReport1.Cell("E4").Str = "値で指定(60度)";cellReport1.Cell("F4").Attr.Orientation = (Orientation)(-60);cellReport1.Cell("F4").Str = "値で指定(-60度)";cellReport1.Page.End();// 帳票ページを作成cellReport1.Page.Start("配置(文字の制御)", "1-999");// 値の設定cellReport1.Cell("A1").Attr.FontPoint = 14;cellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.Bold;cellReport1.Cell("A1").Str = "文字の制御の設定";cellReport1.Cell("A").ColWidth = 16;// [配置] - [折り返して全体を表示する] を設定cellReport1.Cell("A2").Str = "折り返し(ON)";cellReport1.Cell("B2").Attr.WrapText = true;cellReport1.Cell("B2").RowHeight = 41;cellReport1.Cell("B2").Str = "abcdefghijklmnopqrstuvwxyz";cellReport1.Cell("A3").Str = "折り返し(OFF)";cellReport1.Cell("B3").Attr.WrapText = false;cellReport1.Cell("B3").Str = "abcdefghijklmnopqrstuvwxyz";// [配置] - [縮小して全体を表示する] を設定cellReport1.Cell("A5").Str = "縮小(ON)";cellReport1.Cell("B5").Attr.ShrinkToFit = true;cellReport1.Cell("B5").Str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";cellReport1.Cell("A6").Str = "縮小(OFF)";cellReport1.Cell("B6").Attr.ShrinkToFit = false;cellReport1.Cell("B6").Str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";// [配置] - [セルを結合する] を設定cellReport1.Cell("A8").Str = "B8:C8 セルを結合";cellReport1.Cell("B8:C8").Attr.MergeCells = true;cellReport1.Cell("B8:C8").Value = 1234567890;cellReport1.Cell("B8:C8").Attr.Box(BoxType.Ltc, BorderStyle.Thin, xlColor.Black);cellReport1.Page.End();// 帳票ページを作成cellReport1.Page.Start("フォント", "1-999");// 値の設定cellReport1.Page.Attr.Size(PageOrientation.Landscape, 100, PaperKind.A4);cellReport1.Cell("A1").Attr.FontPoint = 14;cellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.Bold;cellReport1.Cell("A1").Str = "フォントの設定" + "(Xlsx形式)";cellReport1.Cell("A").ColWidth = 18;cellReport1.Cell("B:D").ColWidth = 33;// フォントの種類、フォントサイズを設定cellReport1.Cell("A2").Str = "フォント名(サイズ)";cellReport1.Cell("B2:B4").Attr.FontName = "MS P明朝";cellReport1.Cell("B2").Attr.FontPoint = 8;cellReport1.Cell("B2").Str = "MS P明朝(8)";cellReport1.Cell("B3").Attr.FontPoint = 11;cellReport1.Cell("B3").Str = "MS P明朝(11)";cellReport1.Cell("B4").Attr.FontPoint = 20;cellReport1.Cell("B4").Str = "MS P明朝(20)";cellReport1.Cell("B4").RowHeight = 26;cellReport1.Cell("C2:C4").Attr.FontName = "MS ゴシック";cellReport1.Cell("C2").Attr.FontPoint = 8;cellReport1.Cell("C2").Str = "MS ゴシック(8)";cellReport1.Cell("C3").Attr.FontPoint = 11;cellReport1.Cell("C3").Str = "MS ゴシック(11)";cellReport1.Cell("C4").Attr.FontPoint = 20;cellReport1.Cell("C4").Str = "MS ゴシック(20)";cellReport1.Cell("D2:D4").Attr.FontName = "Meiryo";cellReport1.Cell("D2").Attr.FontPoint = 8;cellReport1.Cell("D2").Str = "Meiryo (8)";cellReport1.Cell("D3").Attr.FontPoint = 11;cellReport1.Cell("D3").Str = "Meiryo (11)";cellReport1.Cell("D4").Attr.FontPoint = 20;cellReport1.Cell("D4").Str = "Meiryo (20)";cellReport1.Cell("E2:E4").Attr.FontName = "Arial";cellReport1.Cell("E2").Attr.FontPoint = 8;cellReport1.Cell("E2").Str = "Arial (8)";cellReport1.Cell("E3").Attr.FontPoint = 11;cellReport1.Cell("E3").Str = "Arial (11)";cellReport1.Cell("E4").Attr.FontPoint = 20;cellReport1.Cell("E4").Str = "Arial (20)";// フォントのスタイル、文字飾りを設定cellReport1.Cell("A6").Str = "スタイル、文字飾り";cellReport1.Cell("B6").Attr.FontStyle = VBReport.FontStyle.Normal;cellReport1.Cell("B6").Str = "標準";cellReport1.Cell("C6").Attr.FontStyle = VBReport.FontStyle.Italic;cellReport1.Cell("C6").Str = "斜体";cellReport1.Cell("D6").Attr.FontStyle = VBReport.FontStyle.Bold;cellReport1.Cell("D6").Str = "太字";cellReport1.Cell("B7").Attr.FontStyle = VBReport.FontStyle.Bold | VBReport.FontStyle.Italic;cellReport1.Cell("B7").Str = "太字 斜体";cellReport1.Cell("B8").Attr.FontStyle = VBReport.FontStyle.Strike;cellReport1.Cell("B8").Str = "取り消し線";cellReport1.Cell("C8").Attr.FontStyle = VBReport.FontStyle.Up;cellReport1.Cell("C8").Str = "上付き";cellReport1.Cell("D8").Attr.FontStyle = VBReport.FontStyle.Down;cellReport1.Cell("D8").Str = "下付き";// フォントの下線を設定cellReport1.Cell("A10").Str = "下線";cellReport1.Cell("B10").Attr.FontULine = FontULine.Normal;cellReport1.Cell("B10").Str = "下線";cellReport1.Cell("C10").Attr.FontULine = FontULine.Double;cellReport1.Cell("C10").Str = "二重下線";// xls 形式の色定数(xlColor 列挙体)による文字色を設定// xlsx 形式の帳票出力でも設定が可能cellReport1.Cell("A12").Str = "色(定数)";cellReport1.Cell("B13").Attr.FontColor2 = xlColor.Red;cellReport1.Cell("B13").Str = "赤(xlColor.Red)";cellReport1.Cell("C13").Attr.FontColor2 = xlColor.Green;cellReport1.Cell("C13").Str = "緑(xlColor.Green)";cellReport1.Cell("D13").Attr.FontColor2 = xlColor.Blue;cellReport1.Cell("D13").Str = "青(xlColor.Blue)";cellReport1.Cell("B14").Attr.FontColor2 = xlColor.Purple;cellReport1.Cell("B14").Str = "紫(xlColor.Purple)";cellReport1.Cell("C14").Attr.FontColor2 = xlColor.Gray;cellReport1.Cell("C14").Str = "グレー(xlColor.Gray)";cellReport1.Cell("D14").Attr.FontColor2 = xlColor.Orange;cellReport1.Cell("D14").Str = "オレンジ(xlColor.Orange)";// RGB 値(System.Drawing.Color 構造体)による文字色を設定// xls 形式の帳票出力では設定が無効cellReport1.Cell("A16").Str = "色(RGB)";cellReport1.Cell("B16").Str = "※ xlsx 形式での設定時のみ使用可能です。";cellReport1.Cell("b16").Attr.FontStyle = VBReport.FontStyle.Bold;cellReport1.Cell("B17").Attr.FontColor = Color.FromArgb(255, 0, 0);cellReport1.Cell("B17").Str = "赤(255, 0, 0)";cellReport1.Cell("C17").Attr.FontColor = Color.FromArgb(0, 255, 0);cellReport1.Cell("C17").Str = "緑(0, 255, 0)";cellReport1.Cell("D17").Attr.FontColor = Color.FromArgb(0, 0, 255);cellReport1.Cell("D17").Str = "青(0, 0, 255)";cellReport1.Cell("B18").Attr.FontColor = Color.FromArgb(128, 0, 128);cellReport1.Cell("B18").Str = "紫(128, 0, 128)";cellReport1.Cell("C18").Attr.FontColor = Color.FromArgb(153, 153, 255);cellReport1.Cell("C18").Str = "グレー(153, 153, 255)";cellReport1.Cell("D18").Attr.FontColor = Color.FromArgb(255, 102, 0);cellReport1.Cell("D18").Str = "オレンジ(255, 102, 0)";cellReport1.Page.End();// 帳票ページを作成cellReport1.Page.Start("罫線", "1-999");// 値の設定cellReport1.Cell("A1").Attr.FontPoint = 14;cellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.Bold;cellReport1.Cell("A1").Str = "罫線の設定" + "(Xlsx形式)";cellReport1.Cell("A2").Str = "※色の指定には RGB 値と色定数がありますが、RGB 値の指定は xlsx 形式での設定時のみ使用可能です。";cellReport1.Cell("A2").Attr.FontColor2 = xlColor.Red;cellReport1.Cell("B").ColWidth = 18;cellReport1.Cell("D").ColWidth = 18;cellReport1.Cell("F").ColWidth = 18;// 各方向の罫線と線種を設定cellReport1.Cell("B3").Str = "実線";cellReport1.Cell("B3").Attr.LineLeft(BorderStyle.Thin, xlColor.Black);cellReport1.Cell("B3").Attr.LineTop(BorderStyle.Thin, xlColor.Black);cellReport1.Cell("B3").Attr.LineRight(BorderStyle.Thin, xlColor.Black);cellReport1.Cell("B3").Attr.LineBottom(BorderStyle.Thin, xlColor.Black);cellReport1.Cell("D3").Str = "太線";cellReport1.Cell("D3").Attr.LineLeft(BorderStyle.Medium, xlColor.Black);cellReport1.Cell("D3").Attr.LineTop(BorderStyle.Medium, xlColor.Black);cellReport1.Cell("D3").Attr.LineRight(BorderStyle.Medium, xlColor.Black);cellReport1.Cell("D3").Attr.LineBottom(BorderStyle.Medium, xlColor.Black);cellReport1.Cell("F3").Str = "破線";cellReport1.Cell("F3").Attr.LineLeft(BorderStyle.Dashed, xlColor.Black);cellReport1.Cell("F3").Attr.LineTop(BorderStyle.Dashed, xlColor.Black);cellReport1.Cell("F3").Attr.LineRight(BorderStyle.Dashed, xlColor.Black);cellReport1.Cell("F3").Attr.LineBottom(BorderStyle.Dashed, xlColor.Black);cellReport1.Cell("B5").Str = "点線";cellReport1.Cell("B5").Attr.LineLeft(BorderStyle.Dotted, xlColor.Black);cellReport1.Cell("B5").Attr.LineTop(BorderStyle.Dotted, xlColor.Black);cellReport1.Cell("B5").Attr.LineRight(BorderStyle.Dotted, xlColor.Black);cellReport1.Cell("B5").Attr.LineBottom(BorderStyle.Dotted, xlColor.Black);cellReport1.Cell("D5").Str = "極太線";cellReport1.Cell("D5").Attr.LineLeft(BorderStyle.Thick, xlColor.Black);cellReport1.Cell("D5").Attr.LineTop(BorderStyle.Thick, xlColor.Black);cellReport1.Cell("D5").Attr.LineRight(BorderStyle.Thick, xlColor.Black);cellReport1.Cell("D5").Attr.LineBottom(BorderStyle.Thick, xlColor.Black);cellReport1.Cell("F5").Str = "二重線";cellReport1.Cell("F5").Attr.LineLeft(BorderStyle.Double, xlColor.Black);cellReport1.Cell("F5").Attr.LineTop(BorderStyle.Double, xlColor.Black);cellReport1.Cell("F5").Attr.LineRight(BorderStyle.Double, xlColor.Black);cellReport1.Cell("F5").Attr.LineBottom(BorderStyle.Double, xlColor.Black);cellReport1.Cell("B7").Str = "細実線";cellReport1.Cell("B7").Attr.LineLeft(BorderStyle.Hair, xlColor.Black);cellReport1.Cell("B7").Attr.LineTop(BorderStyle.Hair, xlColor.Black);cellReport1.Cell("B7").Attr.LineRight(BorderStyle.Hair, xlColor.Black);cellReport1.Cell("B7").Attr.LineBottom(BorderStyle.Hair, xlColor.Black);cellReport1.Cell("D7").Str = "中破線";cellReport1.Cell("D7").Attr.LineLeft(BorderStyle.MediumDashed, xlColor.Black);cellReport1.Cell("D7").Attr.LineTop(BorderStyle.MediumDashed, xlColor.Black);cellReport1.Cell("D7").Attr.LineRight(BorderStyle.MediumDashed, xlColor.Black);cellReport1.Cell("D7").Attr.LineBottom(BorderStyle.MediumDashed, xlColor.Black);cellReport1.Cell("F7").Str = "細一点鎖線";cellReport1.Cell("F7").Attr.LineLeft(BorderStyle.DashDot, xlColor.Black);cellReport1.Cell("F7").Attr.LineTop(BorderStyle.DashDot, xlColor.Black);cellReport1.Cell("F7").Attr.LineRight(BorderStyle.DashDot, xlColor.Black);cellReport1.Cell("F7").Attr.LineBottom(BorderStyle.DashDot, xlColor.Black);cellReport1.Cell("B9").Str = "中一点鎖線";cellReport1.Cell("B9").Attr.LineLeft(BorderStyle.MediumDashDot, xlColor.Black);cellReport1.Cell("B9").Attr.LineTop(BorderStyle.MediumDashDot, xlColor.Black);cellReport1.Cell("B9").Attr.LineRight(BorderStyle.MediumDashDot, xlColor.Black);cellReport1.Cell("B9").Attr.LineBottom(BorderStyle.MediumDashDot, xlColor.Black);cellReport1.Cell("D9").Str = "細二点鎖線";cellReport1.Cell("D9").Attr.LineLeft(BorderStyle.DashDotDot, xlColor.Black);cellReport1.Cell("D9").Attr.LineTop(BorderStyle.DashDotDot, xlColor.Black);cellReport1.Cell("D9").Attr.LineRight(BorderStyle.DashDotDot, xlColor.Black);cellReport1.Cell("D9").Attr.LineBottom(BorderStyle.DashDotDot, xlColor.Black);cellReport1.Cell("F9").Str = "中二点鎖線";cellReport1.Cell("F9").Attr.LineLeft(BorderStyle.MediumDashDotDot, xlColor.Black);cellReport1.Cell("F9").Attr.LineTop(BorderStyle.MediumDashDotDot, xlColor.Black);cellReport1.Cell("F9").Attr.LineRight(BorderStyle.MediumDashDotDot, xlColor.Black);cellReport1.Cell("F9").Attr.LineBottom(BorderStyle.MediumDashDotDot, xlColor.Black);cellReport1.Cell("B11").Str = "中一点斜鎖線";cellReport1.Cell("B11").Attr.LineLeft(BorderStyle.SlantDashDot, xlColor.Black);cellReport1.Cell("B11").Attr.LineTop(BorderStyle.SlantDashDot, xlColor.Black);cellReport1.Cell("B11").Attr.LineRight(BorderStyle.SlantDashDot, xlColor.Black);cellReport1.Cell("B11").Attr.LineBottom(BorderStyle.SlantDashDot, xlColor.Black);// 各方向の罫線と線の色を指定// 色の指定には RGB 値と色定数(xlColor 列挙体)がありますが、RGB 値の指定は xlsx 形式でのみ可能cellReport1.Cell("B13").Str = "実線(赤)";cellReport1.Cell("B13").Attr.LineLeft(BorderStyle.Thin, xlColor.Red);cellReport1.Cell("B13").Attr.LineTop(BorderStyle.Thin, xlColor.Red);cellReport1.Cell("B13").Attr.LineRight(BorderStyle.Thin, xlColor.Red);cellReport1.Cell("B13").Attr.LineBottom(BorderStyle.Thin, xlColor.Red);cellReport1.Cell("D13").Str = "太線(緑)";cellReport1.Cell("D13").Attr.LineLeft(BorderStyle.Medium, xlColor.Green);cellReport1.Cell("D13").Attr.LineTop(BorderStyle.Medium, xlColor.Green);cellReport1.Cell("D13").Attr.LineRight(BorderStyle.Medium, xlColor.Green);cellReport1.Cell("D13").Attr.LineBottom(BorderStyle.Medium, xlColor.Green);cellReport1.Cell("F13").Str = "破線(青)";cellReport1.Cell("F13").Attr.LineLeft(BorderStyle.Dashed, xlColor.Blue);cellReport1.Cell("F13").Attr.LineTop(BorderStyle.Dashed, xlColor.Blue);cellReport1.Cell("F13").Attr.LineRight(BorderStyle.Dashed, xlColor.Blue);cellReport1.Cell("F13").Attr.LineBottom(BorderStyle.Dashed, xlColor.Blue);cellReport1.Cell("B15").Str = "点線(紫)";cellReport1.Cell("B15").Attr.LineLeft(BorderStyle.Dotted, xlColor.Purple);cellReport1.Cell("B15").Attr.LineTop(BorderStyle.Dotted, xlColor.Purple);cellReport1.Cell("B15").Attr.LineRight(BorderStyle.Dotted, xlColor.Purple);cellReport1.Cell("B15").Attr.LineBottom(BorderStyle.Dotted, xlColor.Purple);cellReport1.Cell("D15").Str = "極太線(グレー)";cellReport1.Cell("D15").Attr.LineLeft(BorderStyle.Thick, xlColor.Gray);cellReport1.Cell("D15").Attr.LineTop(BorderStyle.Thick, xlColor.Gray);cellReport1.Cell("D15").Attr.LineRight(BorderStyle.Thick, xlColor.Gray);cellReport1.Cell("D15").Attr.LineBottom(BorderStyle.Thick, xlColor.Gray);cellReport1.Cell("F15").Str = "二重線(オレンジ)";cellReport1.Cell("F15").Attr.LineLeft(BorderStyle.Double, xlColor.Orange);cellReport1.Cell("F15").Attr.LineTop(BorderStyle.Double, xlColor.Orange);cellReport1.Cell("F15").Attr.LineRight(BorderStyle.Double, xlColor.Orange);cellReport1.Cell("F15").Attr.LineBottom(BorderStyle.Double, xlColor.Orange);// 左上がり斜線、右上がり斜線cellReport1.Cell("B17").Attr.LineLeftUp(BorderStyle.Thin, xlColor.Black);cellReport1.Cell("D17").Attr.LineRightUp(BorderStyle.Medium, xlColor.Black);cellReport1.Cell("F17").Attr.LineLeftUp(BorderStyle.Dashed, xlColor.Black);cellReport1.Cell("B19").Attr.LineRightUp(BorderStyle.Dotted, xlColor.Black);cellReport1.Cell("D19").Attr.LineLeftUp(BorderStyle.Thick, xlColor.Black);cellReport1.Cell("F19").Attr.LineRightUp(BorderStyle.Double, xlColor.Black);cellReport1.Cell("B21").Attr.LineLeftUp(BorderStyle.Hair, xlColor.Black);cellReport1.Cell("D21").Attr.LineRightUp(BorderStyle.MediumDashed, xlColor.Black);cellReport1.Cell("F21").Attr.LineLeftUp(BorderStyle.DashDot, xlColor.Black);cellReport1.Cell("B23").Attr.LineRightUp(BorderStyle.MediumDashDot, xlColor.Black);cellReport1.Cell("D23").Attr.LineLeftUp(BorderStyle.DashDotDot, xlColor.Black);cellReport1.Cell("F23").Attr.LineRightUp(BorderStyle.MediumDashDotDot, xlColor.Black);cellReport1.Cell("B25").Attr.LineLeftUp(BorderStyle.SlantDashDot, xlColor.Black);// 左上がり斜線(色)、右上がり斜線(色)cellReport1.Cell("B27").Attr.LineLeftUp(BorderStyle.Thin, xlColor.Red);cellReport1.Cell("D27").Attr.LineRightUp(BorderStyle.Medium, xlColor.Green);cellReport1.Cell("F27").Attr.LineLeftUp(BorderStyle.Dashed, xlColor.Blue);cellReport1.Cell("B29").Attr.LineRightUp(BorderStyle.Dotted, xlColor.Purple);cellReport1.Cell("D29").Attr.LineLeftUp(BorderStyle.Thick, xlColor.Gray);cellReport1.Cell("F29").Attr.LineRightUp(BorderStyle.Double, xlColor.Orange);// Box 罫線を設定// 引数については罫線設定の機能と同様cellReport1.Cell("B31").Str = "箱線(実線)";cellReport1.Cell("B31").Attr.Box(BoxType.Box, BorderStyle.Thin, xlColor.Black);cellReport1.Cell("D31").Str = "上横線(太線)";cellReport1.Cell("D31").Attr.Box(BoxType.Over, BorderStyle.Medium, xlColor.Black);cellReport1.Cell("F31").Str = "下横線(破線)";cellReport1.Cell("F31").Attr.Box(BoxType.Under, BorderStyle.Dashed, xlColor.Black);cellReport1.Cell("B33").Str = "左縦線(点線)";cellReport1.Cell("B33").Attr.Box(BoxType.Left, BorderStyle.Dotted, xlColor.Black);cellReport1.Cell("D33").Str = "右縦線(極太線)";cellReport1.Cell("D33").Attr.Box(BoxType.Right, BorderStyle.Thick, xlColor.Black);cellReport1.Cell("B35").Str = "格子線(赤二重線)";cellReport1.Cell("B35:F37").Attr.Box(BoxType.Ltc, BorderStyle.Double, xlColor.Red);cellReport1.Page.End();// 帳票ページを作成cellReport1.Page.Start("塗りつぶし(背景色)", "1-999");// 値の設定cellReport1.Page.Attr.Size(PageOrientation.Landscape, 100, PaperKind.A4);cellReport1.Cell("A1").Attr.FontPoint = 14;cellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.Bold;cellReport1.Cell("A1").Str = "背景色の設定" + "(Xlsx形式)";// xls 形式の色定数(xlColor 列挙体)による文字色を設定// xlsx 形式の帳票出力でも設定が可能cellReport1.Cell("A3").Str = "書式設定の定数";cellReport1.Cell("B4").Attr.BackColor2 = xlColor.Black; // 黒
cellReport1.Cell("D4").Attr.BackColor2 = xlColor.White; // 白
cellReport1.Cell("F4").Attr.BackColor2 = xlColor.Red; // 赤
cellReport1.Cell("H4").Attr.BackColor2 = xlColor.Green; // 緑
cellReport1.Cell("J4").Attr.BackColor2 = xlColor.Blue; // 青
cellReport1.Cell("L4").Attr.BackColor2 = xlColor.Yellow; // 黄
cellReport1.Cell("N4").Attr.BackColor2 = xlColor.Pink; // ピンク
cellReport1.Cell("B6").Attr.BackColor2 = xlColor.Cyan; // 水
cellReport1.Cell("D6").Attr.BackColor2 = xlColor.DarkRed; // 濃い赤
cellReport1.Cell("F6").Attr.BackColor2 = xlColor.DarkGreen; // 濃い緑
cellReport1.Cell("H6").Attr.BackColor2 = xlColor.DrakBlue; // 濃い青
cellReport1.Cell("J6").Attr.BackColor2 = xlColor.DrakYellow; // 濃い黄
cellReport1.Cell("L6").Attr.BackColor2 = xlColor.Purple; // 紫
cellReport1.Cell("N6").Attr.BackColor2 = xlColor.BlueGreen; // 青緑
cellReport1.Cell("B8").Attr.BackColor2 = xlColor.Gray25; // 25%灰色
cellReport1.Cell("D8").Attr.BackColor2 = xlColor.Gray50; // 50%灰色
cellReport1.Cell("F8").Attr.BackColor2 = xlColor.Gray; // グレー
cellReport1.Cell("H8").Attr.BackColor2 = xlColor.Plum; // プラム
cellReport1.Cell("J8").Attr.BackColor2 = xlColor.Ivory; // アイボリー
cellReport1.Cell("L8").Attr.BackColor2 = xlColor.LightBlue; // 薄い水色
cellReport1.Cell("N8").Attr.BackColor2 = xlColor.DrakPurple; // 濃い紫
cellReport1.Cell("B10").Attr.BackColor2 = xlColor.Coral; // コーラル
cellReport1.Cell("D10").Attr.BackColor2 = xlColor.OceanBlue; // オーシャンブルー
cellReport1.Cell("F10").Attr.BackColor2 = xlColor.IceBlue; // アイスブルー
cellReport1.Cell("H10").Attr.BackColor2 = xlColor.DrakBlue2; // 濃い青
cellReport1.Cell("J10").Attr.BackColor2 = xlColor.Pink2; // ピンク
cellReport1.Cell("L10").Attr.BackColor2 = xlColor.Yellow2; // 黄色
cellReport1.Cell("N10").Attr.BackColor2 = xlColor.Cyan2; // 水色// RGB 値(System.Drawing.Color 構造体)による文字色を設定// xls 形式の帳票出力では設定が無効cellReport1.Cell("A11").Str = "RGB 値";cellReport1.Cell("B11").Str = "※ xlsx 形式での設定時のみ使用可能です。";cellReport1.Cell("B11").Attr.FontColor2 = xlColor.Red;cellReport1.Cell("B12").Attr.BackColor = Color.FromArgb(128, 0, 128); // 紫
cellReport1.Cell("D12").Attr.BackColor = Color.FromArgb(128, 0, 0); // 濃い赤
cellReport1.Cell("F12").Attr.BackColor = Color.FromArgb(0, 128, 128); // 青緑
cellReport1.Cell("H12").Attr.BackColor = Color.FromArgb(0, 0, 255); // 青
cellReport1.Cell("J12").Attr.BackColor = Color.FromArgb(0, 204, 255); // スカイブルー
cellReport1.Cell("L12").Attr.BackColor = Color.FromArgb(204, 255, 255); // 薄い水色
cellReport1.Cell("N11").Attr.BackColor = Color.FromArgb(204, 255, 204); // 薄い緑
cellReport1.Cell("B14").Attr.BackColor = Color.FromArgb(255, 255, 153); // 薄い黄色
cellReport1.Cell("D14").Attr.BackColor = Color.FromArgb(153, 204, 255); // ベールブルー
cellReport1.Cell("F14").Attr.BackColor = Color.FromArgb(255, 153, 204); // ローズ
cellReport1.Cell("H14").Attr.BackColor = Color.FromArgb(204, 153, 255); // ラベンダー
cellReport1.Cell("J14").Attr.BackColor = Color.FromArgb(255, 204, 153); // ベージュ
cellReport1.Cell("L14").Attr.BackColor = Color.FromArgb(51, 102, 255); // 薄い青
cellReport1.Cell("N14").Attr.BackColor = Color.FromArgb(51, 204, 204); // アクア
cellReport1.Cell("B16").Attr.BackColor = Color.FromArgb(153, 204, 0); // ライム
cellReport1.Cell("D16").Attr.BackColor = Color.FromArgb(255, 204, 0); // ゴールド
cellReport1.Cell("F16").Attr.BackColor = Color.FromArgb(255, 153, 0); // 薄いオレンジ
cellReport1.Cell("H16").Attr.BackColor = Color.FromArgb(255, 102, 0); // オレンジ
cellReport1.Cell("J16").Attr.BackColor = Color.FromArgb(102, 102, 153); // ブルーグレー
cellReport1.Cell("L16").Attr.BackColor = Color.FromArgb(150, 150, 150); // 40%灰色
cellReport1.Cell("N16").Attr.BackColor = Color.FromArgb(0, 51, 102); // 濃い青緑
cellReport1.Cell("B18").Attr.BackColor = Color.FromArgb(51, 153, 102); // シーグリーン
cellReport1.Cell("D18").Attr.BackColor = Color.FromArgb(0, 51, 0); // 濃い緑
cellReport1.Cell("F18").Attr.BackColor = Color.FromArgb(51, 51, 0); // オリーブ
cellReport1.Cell("H18").Attr.BackColor = Color.FromArgb(153, 51, 0); // 茶
cellReport1.Cell("J18").Attr.BackColor = Color.FromArgb(153, 51, 102); // プラム
cellReport1.Cell("L18").Attr.BackColor = Color.FromArgb(51, 51, 153); // インディゴ
cellReport1.Cell("N18").Attr.BackColor = Color.FromArgb(51, 51, 51); // 80%灰色cellReport1.Page.End();// 帳票ページを作成cellReport1.Page.Start("塗りつぶし(パターン)", "1-999");// 値の設定cellReport1.Page.Attr.Size(PageOrientation.Landscape, 100, PaperKind.A4);cellReport1.Cell("A1").Attr.FontPoint = 14;cellReport1.Cell("A1").Attr.FontStyle = VBReport.FontStyle.Bold;cellReport1.Cell("A1").Str = "パターンの設定" + "(Xlsx形式)";cellReport1.Cell("A").ColWidth = 18;// [パターン] を設定cellReport1.Cell("A3").Str = "パターン";cellReport1.Cell("B3").Attr.Pattern = Pattern.Solid;cellReport1.Cell("D3").Attr.Pattern = Pattern.MediumGray;cellReport1.Cell("F3").Attr.Pattern = Pattern.DarkGray;cellReport1.Cell("H3").Attr.Pattern = Pattern.LightGray;cellReport1.Cell("J3").Attr.Pattern = Pattern.DarkHorizontal;cellReport1.Cell("L3").Attr.Pattern = Pattern.DarkVertical;cellReport1.Cell("B5").Attr.Pattern = Pattern.DarkDown;cellReport1.Cell("D5").Attr.Pattern = Pattern.DarkUp;cellReport1.Cell("F5").Attr.Pattern = Pattern.DarkGrid;cellReport1.Cell("H5").Attr.Pattern = Pattern.DarkTrellis;cellReport1.Cell("J5").Attr.Pattern = Pattern.LightHorizontal;cellReport1.Cell("L5").Attr.Pattern = Pattern.LightVertical;cellReport1.Cell("B7").Attr.Pattern = Pattern.LightDown;cellReport1.Cell("D7").Attr.Pattern = Pattern.LightUp;cellReport1.Cell("F7").Attr.Pattern = Pattern.LightGrid;cellReport1.Cell("H7").Attr.Pattern = Pattern.LightTrellis;cellReport1.Cell("J7").Attr.Pattern = Pattern.Gray125;cellReport1.Cell("L7").Attr.Pattern = Pattern.Gray0625;// [パターン] の色を設定// ForeColor2 で xls 形式の色定数(xlColor列挙体)、ForeColor で RGB 値(System.Drawing.Color 構造体)での指定が可能// ForeColor は xlsx 形式でのみ有効// パターン(色)cellReport1.Cell("A9").Str = "パターン(色)";cellReport1.Cell("B9").Str = "※左 3 列は色定数、右 3 列は RGB 値(xlsx 形式でのみ対応)";cellReport1.Cell("B9").Attr.FontColor2 = xlColor.Red;cellReport1.Cell("B10").Attr.Pattern = Pattern.LightDown;cellReport1.Cell("B10").Attr.ForeColor2 = xlColor.Red;cellReport1.Cell("D10").Attr.Pattern = Pattern.MediumGray;cellReport1.Cell("D10").Attr.ForeColor2 = xlColor.Green;cellReport1.Cell("F10").Attr.Pattern = Pattern.DarkGray;cellReport1.Cell("F10").Attr.ForeColor2 = xlColor.Blue;cellReport1.Cell("H10").Attr.Pattern = Pattern.LightGray;cellReport1.Cell("H10").Attr.ForeColor = Color.FromArgb(255, 0, 0);cellReport1.Cell("J10").Attr.Pattern = Pattern.DarkHorizontal;cellReport1.Cell("J10").Attr.ForeColor = Color.FromArgb(0, 255, 0);cellReport1.Cell("L10").Attr.Pattern = Pattern.DarkVertical;cellReport1.Cell("L10").Attr.ForeColor = Color.FromArgb(0, 0, 255);// パターン+背景色cellReport1.Cell("A11").Str = "パターン+背景色";cellReport1.Cell("B11").Str = "※左 3 列は色定数、右 3 列は RGB 値(xlsx 形式でのみ対応)";cellReport1.Cell("B11").Attr.FontColor2 = xlColor.Red;cellReport1.Cell("B12").Attr.Pattern = Pattern.DarkDown;cellReport1.Cell("B12").Attr.ForeColor2 = xlColor.White;cellReport1.Cell("B12").Attr.BackColor2 = xlColor.Black;cellReport1.Cell("D12").Attr.Pattern = Pattern.DarkUp;cellReport1.Cell("D12").Attr.ForeColor2 = xlColor.Black;cellReport1.Cell("D12").Attr.BackColor2 = xlColor.White;cellReport1.Cell("F12").Attr.Pattern = Pattern.DarkGrid;cellReport1.Cell("F12").Attr.ForeColor2 = xlColor.Red;cellReport1.Cell("F12").Attr.BackColor2 = xlColor.White;cellReport1.Cell("H12").Attr.Pattern = Pattern.DarkTrellis;cellReport1.Cell("H12").Attr.ForeColor = Color.FromArgb(0, 255, 0);cellReport1.Cell("H12").Attr.BackColor = Color.FromArgb(0, 0, 255);cellReport1.Cell("J12").Attr.Pattern = Pattern.LightHorizontal;cellReport1.Cell("J12").Attr.ForeColor = Color.FromArgb(0, 0, 0);cellReport1.Cell("J12").Attr.BackColor = Color.FromArgb(255, 255, 255);cellReport1.Cell("L12").Attr.Pattern = Pattern.LightVertical;cellReport1.Cell("L12").Attr.ForeColor = Color.FromArgb(255, 0, 0);cellReport1.Cell("L12").Attr.BackColor = Color.FromArgb(255, 255, 255);cellReport1.Page.End();// 帳票終了処理cellReport1.Report.End();// 作成した帳票を SVG 形式で取得string document = cellReport1.Report.GetSvgReport(SvgSaveType.IncludeExcelPdf);ReportData reportData = new ReportData();reportData.Document = document;return reportData;}