Ejemplo n.º 1
0
        internal Selection ToSelection()
        {
            Selection s = new Selection();

            if (this.Pane != PaneValues.TopLeft)
            {
                s.Pane = this.Pane;
            }

            if (this.ActiveCell.Length > 0 && !this.ActiveCell.Equals("A1", StringComparison.OrdinalIgnoreCase))
            {
                s.ActiveCell = this.ActiveCell;
            }

            if (this.ActiveCellId != 0)
            {
                s.ActiveCellId = this.ActiveCellId;
            }

            if (this.SequenceOfReferences.Count > 0)
            {
                if (this.SequenceOfReferences.Count == 1)
                {
                    // not equal to A1
                    if (this.SequenceOfReferences[0].StartRowIndex != 1 ||
                        this.SequenceOfReferences[0].StartColumnIndex != 1 ||
                        this.SequenceOfReferences[0].EndRowIndex != 1 ||
                        this.SequenceOfReferences[0].EndColumnIndex != 1)
                    {
                        s.SequenceOfReferences = SLTool.TranslateCellPointRangeToSeqRef(this.SequenceOfReferences);
                    }
                }
                else
                {
                    s.SequenceOfReferences = SLTool.TranslateCellPointRangeToSeqRef(this.SequenceOfReferences);
                }
            }

            return(s);
        }
        internal DataValidation ToDataValidation()
        {
            DataValidation dv = new DataValidation();

            if (this.Formula1.Length > 0)
            {
                dv.Formula1 = new Formula1(this.Formula1);
            }
            if (this.Formula2.Length > 0)
            {
                dv.Formula2 = new Formula2(this.Formula2);
            }

            if (this.Type != DataValidationValues.None)
            {
                dv.Type = this.Type;
            }
            if (this.ErrorStyle != DataValidationErrorStyleValues.Stop)
            {
                dv.ErrorStyle = this.ErrorStyle;
            }
            if (this.ImeMode != DataValidationImeModeValues.NoControl)
            {
                dv.ImeMode = this.ImeMode;
            }
            if (this.Operator != DataValidationOperatorValues.Between)
            {
                dv.Operator = this.Operator;
            }

            if (this.AllowBlank)
            {
                dv.AllowBlank = this.AllowBlank;
            }
            if (this.ShowDropDown)
            {
                dv.ShowDropDown = this.ShowDropDown;
            }
            if (this.ShowInputMessage)
            {
                dv.ShowInputMessage = this.ShowInputMessage;
            }
            if (this.ShowErrorMessage)
            {
                dv.ShowErrorMessage = this.ShowErrorMessage;
            }

            if (this.ErrorTitle.Length > 0)
            {
                dv.ErrorTitle = this.ErrorTitle;
            }
            if (this.Error.Length > 0)
            {
                dv.Error = this.Error;
            }

            if (this.PromptTitle.Length > 0)
            {
                dv.PromptTitle = this.PromptTitle;
            }
            if (this.Prompt.Length > 0)
            {
                dv.Prompt = this.Prompt;
            }

            dv.SequenceOfReferences = SLTool.TranslateCellPointRangeToSeqRef(this.SequenceOfReferences);

            return(dv);
        }