public void SetGlobalValue(string globalValue)
        {
            Cell cell = fpInterfaces_Sheet1.ActiveCell;

            if (cell != null)
            {
                if (fpInterfaces.IsEditing)
                {
                    GeneralEditor generalEditor = fpInterfaces.EditingControl as GeneralEditor;
                    int           start         = generalEditor.SelectionStart;
                    int           length        = generalEditor.SelectionLength;
                    if (generalEditor.Text == null)
                    {
                        generalEditor.Text = " ";
                        generalEditor.Text = string.Empty;
                    }
                    generalEditor.Text = generalEditor.Text.Remove(start, length);
                    generalEditor.Text = generalEditor.Text.Insert(start, globalValue);
                    generalEditor.Select(start + globalValue.Length, 0);
                }
                else
                {
                    cell.Value = cell.Text + globalValue;
                }
                if (Changed != null)
                {
                    Changed(this, null);
                }
            }
        }
 public void SetGlobalValue(string globalValue)
 {
     FarPoint.Win.Spread.Cell cell = sheetMain.ActiveCell;
     if (cell != null)
     {
         if (cell.Tag as Column == null)
         {
             if (IsEditing)
             {
                 GeneralEditor generalEditor = EditingControl as GeneralEditor;
                 int           start         = generalEditor.SelectionStart;
                 int           length        = generalEditor.SelectionLength;
                 if (generalEditor.Text == null)
                 {
                     generalEditor.Text = " ";
                     generalEditor.Text = string.Empty;
                 }
                 generalEditor.Text = generalEditor.Text.Remove(start, length);
                 generalEditor.Text = generalEditor.Text.Insert(start, globalValue);
                 generalEditor.Select(start + globalValue.Length, 0);
             }
             else
             {
                 cell.Value = cell.Text + globalValue;
             }
             if (Changed != null)
             {
                 Changed(this, null);
             }
         }
     }
 }
Exemple #3
0
 public static ValueEditor GetAppropriateEditor(object Value)
 {
     ValueEditor ed;
     if (Value != null && types.ContainsKey(Value.GetType())) ed = types[Value.GetType()];
     else ed = new GeneralEditor();
     ed.SetValue(Value);
     return ed;
 }
Exemple #4
0
        void Button_Click(object sender, EventArgs e)
        {
            ToolStripButton Button = sender as ToolStripButton;

            if (FpSpread.EditingControl is GeneralEditor)
            {
                GeneralEditor generaleditor = FpSpread.EditingControl as GeneralEditor;
                generaleditor.SelectedText = generaleditor.SelectedText + Button.Text;
            }
            else if (FpSpread.EditingControl is FarPoint.Win.Spread.CellType.RichTextEditor)
            {
                FarPoint.Win.Spread.CellType.RichTextEditor richTextEditor = FpSpread.EditingControl as FarPoint.Win.Spread.CellType.RichTextEditor;
                richTextEditor.SelectedText = richTextEditor.SelectedText + Button.Text;
            }

            FpSpread.StartCellEditing(null, false);
        }
Exemple #5
0
        private void DataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewEx gridview = sender as DataGridViewEx;

            if (_SymbolManager != null)
            {
                _SymbolManager.FpSpread.StartCellEditing(null, false);
                if (_SymbolManager.FpSpread.EditingControl is GeneralEditor)
                {
                    GeneralEditor generaleditor = _SymbolManager.FpSpread.EditingControl as GeneralEditor;
                    generaleditor.SelectedText = generaleditor.SelectedText + gridview.CurrentCell.Value.ToString();
                }
                else if (_SymbolManager.FpSpread.EditingControl is FarPoint.Win.Spread.CellType.RichTextEditor)
                {
                    FarPoint.Win.Spread.CellType.RichTextEditor richTextEditor = _SymbolManager.FpSpread.EditingControl as FarPoint.Win.Spread.CellType.RichTextEditor;
                    richTextEditor.SelectedText = richTextEditor.SelectedText + gridview.CurrentCell.Value.ToString();
                }
            }
        }