2009-03-18 11 views

Répondre

4
using CrystalDecisions.CrystalReports.Engine; 

namespace Craft 
{ 
    class Mate 
    { 
     Order_Print _r = new Order_Print(); 

     void Preview() 
     { 
      foreach (FormulaFieldDefinition f in _r.DataDefinition.FormulaFields) 
      { 
       MessageBox.Show(f.Name); 

       f.Text = InputBox.Show("Input the formula for " + f.Name); 
      } 
     } 
    } 
} 
2

Oui, par exemple, nous utilisons la fonction follwoing pour modifier les formules:

Public Sub SetReportFormulaContents(ByRef Report As ReportDocument, ByVal FormulaName As String, ByVal FormulaContents As String) 
    Dim Formula As FormulaFieldDefinition = Nothing 

    ' Get the ReportObject by name and cast it as a FieldObject 
    If TypeOf (Report.DataDefinition.FormulaFields.Item(FormulaName)) Is CrystalDecisions.CrystalReports.Engine.FormulaFieldDefinition Then 
     Formula = Report.DataDefinition.FormulaFields.Item(FormulaName) 
     Formula.Text = FormulaContents 
    End If 
End Sub 
+0

Est-il possible de changer si la syntaxe de la formule est de cristal ou de base? Question: http://stackoverflow.com/questions/2386710/how-to-programmatically-change-a-crystal-reports-formula-from-crystal-syntax-to-b – Rory

Questions connexes