2

有没有办法在不指定特定字段的情况下将相同的格式规则应用于多个表格单元格(将可见设置为 false)。只是以某种方式对当前表格单元格的 Eval() 值并相应地应用格式。例如,仅使用一条规则在报告中隐藏所有具有零值 ([] == 0) 的数字单元格:)

在此处输入图像描述

4

1 回答 1

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);
    }
于 2012-05-16T07:40:00.137 回答