2012-05-15 41 views
2

有沒有辦法將相同的格式規則應用於多個表格單元格(設置可見爲false)而不指定特定的字段。只是以某種方式對當前表格單元格的Eval()值進行相應的格式化。例如。隱藏所有數字單元與零值([] == 0)上的報告只用一個規則:)DevExpress - 對所選單元格應用相同的條件格式

enter image description here

回答

2

解決方案至今 -

private const string ZeroValue = "0,00"; 

    public FISaldoAccountReport() 
    { 
     InitializeComponent(); 

     RegisterEvents(); 
    } 

    private void RegisterEvents() 
    { 
     positionAmountDebitCell.BeforePrint += NumCellBeforePrint; 
     positionAmountCreditCell.BeforePrint += NumCellBeforePrint; 
     positionSaldoCell.BeforePrint += NumCellBeforePrint; 

     partnerAmountDebitCell.BeforePrint += NumCellBeforePrint; 
     partnerAmountCreditCell.BeforePrint += NumCellBeforePrint; 
     partnerSaldoCell.BeforePrint += NumCellBeforePrint; 

     accountAmountDebitCell.BeforePrint += NumCellBeforePrint; 
     accountAmountCreditCell.BeforePrint += NumCellBeforePrint; 
     accountSaldoCell.BeforePrint += NumCellBeforePrint; 

     accountSumCell.BeforePrint += NumCellBeforePrint; 

     reportAmountDebitCell.BeforePrint += NumCellBeforePrint; 
     reportAmountCreditCell.BeforePrint += NumCellBeforePrint; 
     reportSaldoCell.BeforePrint += NumCellBeforePrint; 
    } 

    private static void NumCellBeforePrint(object sender, PrintEventArgs e) 
    { 
     var currentCell = sender as XRTableCell; 
     if (currentCell == null) return; 

     currentCell.Visible = !currentCell.Text.Equals(ZeroValue); 
    } 
+0

你在哪裏把那些代碼?在designer.cs文件中? – Blaise

相關問題