В этом разделе
            
            Предоставляет выражение формулы.
            
            
Объектная модель
Синтаксис
            
            
            
            'Declaration
Public MustInherit Class FormulaExpression
 
            
            public abstract class FormulaExpression
 
            
            public __gc abstract class FormulaExpression
 
            
            public ref class FormulaExpression abstract
 
	 
	
         
Пример
Этот код C#/VB.NET показывает, как задать выражение для сфокусированной формулы в визуальном редакторе электронных таблиц.
    
	
	    
	    
Friend Class SpreadsheetVisualEditorExamples
    '[BLOCK:FocusedFormulaExpression]
    ''' <summary>
    ''' Sets the formula for focused cell of a spreadsheet document.
    ''' </summary>
    ''' <param name="visualEditor">VintaSoft control that allows to display and edit spreadsheet document.</param>
    ''' <param name="formula">Formula that will be set for focused cell.</param>
    Public Shared Sub SetFocusedFormulaExpression(visualEditor As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor, formula As String)
        Try
            ' create the formula expression for focused cell on focused worksheet
            Dim formulaExpression As Vintasoft.Imaging.Office.Spreadsheet.Formulas.FormulaExpression = Vintasoft.Imaging.Office.Spreadsheet.Formulas.FormulaParser.Parse(visualEditor.Document, visualEditor.FocusedWorksheet, visualEditor.FocusedCell, formula, False)
            ' set the focused formula expression in the spreadsheet visual editor
            visualEditor.FocusedFormulaExpression = formulaExpression
        Catch ex As System.Exception
            ' show error message
            System.Windows.Forms.MessageBox.Show(ex.Message)
        End Try
    End Sub
    ''' <summary>
    ''' Test for function that sets the formula for focused cell of a spreadsheet document.
    ''' </summary>
    ''' <param name="visualEditor">VintaSoft control that allows to display and edit spreadsheet document.</param>
    Public Shared Sub TestSetFocusedFormulaExpression(visualEditor As Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor)
        ' set focused formula expression
        SetFocusedFormulaExpression(visualEditor, "SUM(A2:B5)")
    End Sub
    '[ENDBLOCK]
End Class
	     
	 
 
    
	
	    
	    
namespace CSHARP
{
    internal class SpreadsheetVisualEditorExamples
    {
        //[BLOCK:FocusedFormulaExpression]
        /// <summary>
        /// Sets the formula for focused cell of a spreadsheet document.
        /// </summary>
        /// <param name="visualEditor">VintaSoft control that allows to display and edit spreadsheet document.</param>
        /// <param name="formula">Formula that will be set for focused cell.</param>
        public static void SetFocusedFormulaExpression(Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor visualEditor, string formula)
        {
            try
            {
                // create the formula expression for focused cell on focused worksheet
                Vintasoft.Imaging.Office.Spreadsheet.Formulas.FormulaExpression formulaExpression =
                    Vintasoft.Imaging.Office.Spreadsheet.Formulas.FormulaParser.Parse(
                        visualEditor.Document, visualEditor.FocusedWorksheet, visualEditor.FocusedCell, formula, false);
                // set the focused formula expression in the spreadsheet visual editor
                visualEditor.FocusedFormulaExpression = formulaExpression;
            }
            catch (System.Exception ex)
            {
                // show error message
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
        /// <summary>
        /// Test for function that sets the formula for focused cell of a spreadsheet document.
        /// </summary>
        /// <param name="visualEditor">VintaSoft control that allows to display and edit spreadsheet document.</param>
        public static void TestSetFocusedFormulaExpression(Vintasoft.Imaging.Office.Spreadsheet.UI.SpreadsheetVisualEditor visualEditor)
        {
            // set focused formula expression
            SetFocusedFormulaExpression(visualEditor, "SUM(A2:B5)");
        }
        //[ENDBLOCK]
    }
}
	     
	 
 
 
Иерархия наследования
System.Object
   Vintasoft.Imaging.Office.Spreadsheet.Formulas.FormulaExpression
 
Требования
Целевые платформы: .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
 
Смотрите также