Exemple #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            worksheet.ColumnHeaders[2].Width = 100;
            worksheet.ColumnHeaders[4].Width = 120;

            worksheet.SetRangeDataFormat(4, 3, 1, 1, DataFormat.CellDataFormatFlag.Percent,
                                         DataFormat.NumberDataFormatter.NoDecimalDigitsArgument);
            worksheet.SetRangeDataFormat(7, 3, 1, 1, DataFormat.CellDataFormatFlag.Percent,
                                         DataFormat.NumberDataFormatter.NoDecimalDigitsArgument);

            worksheet[4, 4] = new SlideCell();
            worksheet[4, 4] = .5d;
            worksheet[4, 3] = "=E5";

            worksheet[7, 4] = new SlideCell();
            worksheet[7, 4] = .5d;
            worksheet[7, 2] = new NumericProgressCell();
            worksheet[7, 2] = "=E8";
            worksheet[7, 3] = "=E8";

            worksheet[6, 2] = "計算式でE8セルの値を読み込むように設定:=E8";
            worksheet[2, 3] = "スライドを移動してみてください。";

            // link
            worksheet.MergeRange(12, 0, 1, 7);
            worksheet[11, 0] = "カスタマイズしたセルについて詳しくは:";
            worksheet[12, 0] = new unvell.ReoGrid.CellTypes.HyperlinkCell(
                "https://reogrid.net/jp/document/Custom%20Cell", true);
        }
Exemple #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            worksheet.ColumnHeaders[2].Width = 100;
            worksheet.ColumnHeaders[4].Width = 120;

            worksheet.SetRangeDataFormat(4, 3, 1, 1, DataFormat.CellDataFormatFlag.Percent,
                                         DataFormat.NumberDataFormatter.NoDecimalDigitsArgument);
            worksheet.SetRangeDataFormat(7, 3, 1, 1, DataFormat.CellDataFormatFlag.Percent,
                                         DataFormat.NumberDataFormatter.NoDecimalDigitsArgument);

            worksheet[4, 4] = new SlideCell();
            worksheet[4, 4] = .5d;
            worksheet[4, 3] = "=E5";

            worksheet[7, 4] = new SlideCell();
            worksheet[7, 4] = .5d;
            worksheet[7, 2] = new NumericProgressCell();
            worksheet[7, 2] = "=E8";
            worksheet[7, 3] = "=E8";

            worksheet[6, 2] = "bind by '=E8'";
            worksheet[2, 3] = "Try slide the green thumb below...";

            // link
            worksheet.MergeRange(12, 0, 1, 7);
            worksheet[11, 0] = "More info about Custom Cell:";
            worksheet[12, 0] = new unvell.ReoGrid.CellTypes.HyperlinkCell(
                "https://reogrid.net/document/Custom%20Cell", true);
        }
        public NumericProgressForm()
        {
            InitializeComponent();

            var rand = new Random();

            grid[1, 2] = "Try change the value below: ";

            for (int r = 3; r <= 7; r++)
            {
                // set the cell with customized body
                grid.SetCellBody(r, 2, new NumericProgressCell());

                // set formula to get data from the cell of right side
                grid[r, 2] = "=" + new ReoGridPos(r, 3).ToStringCode(); // e.g. D3

                // set data format as percent
                grid.SetRangeDataFormat(new ReoGridRange(r, 3, 1, 1), DataFormat.CellDataFormatFlag.Percent, null);

                // generate a random value
                grid[r, 3] =  rand.Next(100);
            }

            // change selection forward direction to down
            grid.SelectionForwardDirection = SelectionForwardDirection.Down;

            // put focus on cell
            grid.FocusPos = new ReoGridPos(3, 3);

            // link
            grid.MergeRange(12, 0, 1, 7);
            grid[11, 0] = "More info about Custom Cell:";
            grid[12, 0] = new HyperlinkCell(
                "https://reogrid.codeplex.com/wikipage?title=Custom%20Cell&referringTitle=Documentation", true);
        }
        public BuiltInTypesForm()
        {
            InitializeComponent();

            // set grid cursor to windows default
            grid.SetRangeStyle(ReoGridRange.EntireRange, new ReoGridRangeStyle
            {
                Flag = PlainStyleFlag.FontName,
                FontName = "Arial",
            });

            grid.CellsSelectionCursor = Cursors.Default;
            grid.SetSettings(ReoGridSettings.View_ShowGridLine, false);
            grid.SelectionMode = ReoGridSelectionMode.Cell;
            grid.SelectionStyle = ReoGridSelectionStyle.FocusRect;

            var middleStyle = new ReoGridRangeStyle
            {
                Flag = PlainStyleFlag.Padding | PlainStyleFlag.HorizontalAlign,
                Padding = new Padding(2),
                HAlign = ReoGridHorAlign.Center,
            };

            var grayTextStyle = new ReoGridRangeStyle
            {
                Flag = PlainStyleFlag.TextColor,
                TextColor =	Color.DimGray
            };

            grid.MergeRange(1, 1, 1, 6);

            grid.SetRangeStyle(1, 1, 1, 6, new ReoGridRangeStyle
            {
                Flag = PlainStyleFlag.TextColor | PlainStyleFlag.FontSize,
                TextColor = Color.DarkGreen,
                FontSize = 18,
            });

            grid[1, 1] = "Built-in Cell Bodies";

            grid.SetColsWidth(1, 1, 100);
            grid.SetColsWidth(2, 1, 30);
            grid.SetColsWidth(3, 1, 100);
            grid.SetColsWidth(6, 2, 65);

            // button
            grid.MergeRange(3, 2, 1, 2);
            var btn = new ButtonCell("Hello");
            grid[3, 1] = new object[] { "Button: ", btn };
            btn.Click += (s, e) => ShowText("Button clicked.");

            // link
            grid.MergeRange(5, 2, 1, 2);
            var link = new HyperlinkCell("http://www.google.com");
            grid[5, 1] = new object[] { "Hyperlink", link };
            link.Click += (s, e) => System.Diagnostics.Process.Start(grid.GetCellText(5, 2));

            // checkbox
            var checkbox = new CheckBoxCell();
            grid.SetRangeStyle(7, 2, 1, 1, middleStyle);
            grid.SetRangeStyle(8, 2, 1, 1, grayTextStyle);
            grid[7, 1] = new object[] { "Check box", checkbox, "Auto destroy after 5 minutes." };
            grid[8, 2] = "(Keyboard is also supported to change the status of control)";
            checkbox.CheckChanged += (s, e) => ShowText("Check box switch to " + checkbox.ButtonState.ToString());

            // radio & radio group
            grid[10, 1] = "Radio Button";
            grid.SetRangeStyle(10, 2, 3, 1, middleStyle);
            var radioGroup = new RadioButtonGroup();
            grid[10, 2] = new object[,] {
                {new RadioButtonCell() { RadioGroup = radioGroup }, "Apple"},
                {new RadioButtonCell() { RadioGroup = radioGroup }, "Orange"},
                {new RadioButtonCell() { RadioGroup = radioGroup }, "Banana"}
            };
            grid[13, 2] = "(By adding into RadioGroup will make it toggled automatically)";
            grid.SetRangeStyle(13, 2, 1, 1, grayTextStyle);

            // dropdown
            grid.MergeRange(15, 2, 1, 3);
            var dropdown = new DropdownCell(new object[] { "Apple", "Orange", "Banana", "Pear", "Pumpkin", "Cherry", "Coconut" });
            grid[15, 1] = new object[] { "Dropdown", dropdown };
            grid.SetRangeBorder(15, 2, 1, 3, ReoGridBorderPos.Outline, ReoGridBorderStyle.SolidGray);

            // image
            grid.MergeRange(2, 6, 5, 2);
            grid[2, 6] = new ImageCell(Resources.computer_laptop);

            // information cell
            grid.SetRangeBorder(19, 0, 1, 10, ReoGridBorderPos.Top, ReoGridBorderStyle.SolidGray);
        }