public void ShowFormulaDialog() { FormulaEditorUI FormulaEditorUI = new FormulaEditorUI(ActiveSheet); FormulaEditorUI.SetFormula(ActiveSheet.ActiveCell.Formula); if (DialogResult.OK == FormulaEditorUI.ShowDialog()) { ActiveSheet.ActiveCell.Formula = FormulaEditorUI.GetFormula(); } }
void EditElement(object value, int RowIndex, int ColumnIndex) { GridElement Element = value as GridElement; if (Element != null) { if (Element.Value is DataColumn) { DataColumnEditor dataColumnEditor = new DataColumnEditor(Report, ActiveElement, Element); if (DialogResult.OK == dataColumnEditor.ShowDialog()) { ActiveSheet.Cells[ActiveElement].HorizontalAlignment = CellHorizontalAlignment.Center; ActiveSheet.Cells[ActiveElement].VerticalAlignment = CellVerticalAlignment.Center; ActiveSheet.Cells[ActiveElement].Value = dataColumnEditor.ReportElement; Cell Cell = ActiveSheet.Cells[ActiveElement]; Update(Cell.Row.Index, Cell.Column.Index); } } else if (Element.Value is Picture) { ImageEditor imageEditor = new ImageEditor(Report, ActiveElement, Element); if (DialogResult.OK == imageEditor.ShowDialog()) { ActiveSheet.Cells[ActiveElement].HorizontalAlignment = CellHorizontalAlignment.Center; ActiveSheet.Cells[ActiveElement].VerticalAlignment = CellVerticalAlignment.Center; ActiveSheet.Cells[ActiveElement].Value = imageEditor.ReportElement; Cell Cell = ActiveSheet.Cells[ActiveElement]; Update(Cell.Row.Index, Cell.Column.Index); } } else if (Element.Value is Slash) { SlashEditor slashEditor = new SlashEditor(Report, ActiveElement, Element); if (DialogResult.OK == slashEditor.ShowDialog()) { ActiveSheet.Cells[ActiveElement].HorizontalAlignment = CellHorizontalAlignment.Center; ActiveSheet.Cells[ActiveElement].VerticalAlignment = CellVerticalAlignment.Center; ActiveSheet.Cells[ActiveElement].Value = slashEditor.ReportElement; Cell Cell = ActiveSheet.Cells[ActiveElement]; Update(Cell.Row.Index, Cell.Column.Index); } } else if (Element.Value is Formula) { FormulaEditorUI FormulaEditorUI = new FormulaEditorUI(ActiveSheet); FormulaEditorUI.ShowInTaskbar = false; Formula Formula = Element.Value as Formula; FormulaEditorUI.SetFormula(Formula.Expression); if (DialogResult.OK == FormulaEditorUI.ShowDialog()) { Formula.Expression = FormulaEditorUI.GetFormula(); ActiveSheet.Cells[ActiveElement].Formula = FormulaEditorUI.GetFormula(); ActiveSheet.Cells[ActiveElement].HorizontalAlignment = CellHorizontalAlignment.Center; ActiveSheet.Cells[ActiveElement].VerticalAlignment = CellVerticalAlignment.Center; ActiveSheet.Cells[ActiveElement].Value = Element; Cell Cell = ActiveSheet.Cells[ActiveElement]; Update(Cell.Row.Index, Cell.Column.Index); } } else if (Element.Value is LiteralText) { Cell Cell = ActiveSheet.Cells[ActiveElement]; if (!(Cell.CellType is TextCellType)) { Cell.CellType = new TextCellType(); } EventArgs eventArgs = new EventArgs(); FpSpread.StartCellEditing(eventArgs, false); } else if (Element.Value is Variable) { VariableEditor VariableEditor = new VariableEditor(Report.Configuration.ReportParameters, Element); if (DialogResult.OK == VariableEditor.ShowDialog()) { ActiveSheet.Cells[ActiveElement].HorizontalAlignment = CellHorizontalAlignment.Center; ActiveSheet.Cells[ActiveElement].VerticalAlignment = CellVerticalAlignment.Center; ActiveSheet.Cells[ActiveElement].Value = VariableEditor.ReportElement; Cell Cell = ActiveSheet.Cells[ActiveElement]; Update(Cell.Row.Index, Cell.Column.Index); } } else if (Element.Value is ChartPainter) { ChartEditor ChartEditor = new ChartEditor(); ChartEditor.ChartPainter = Element.Value as ChartPainter; if (DialogResult.OK == ChartEditor.ShowDialog()) { Element.Value = ChartEditor.ChartPainter; Cell Cell = ActiveSheet.Cells[ActiveElement]; Update(Cell.Row.Index, Cell.Column.Index); } } } else { Cell Cell = ActiveSheet.Cells[ActiveElement]; if (!(Cell.CellType is TextCellType)) { Cell.CellType = new TextCellType(); } EventArgs eventArgs = new EventArgs(); FpSpread.StartCellEditing(eventArgs, false); } }