How export unformated value?

a TextObject, its Text is "[Substring([source.Mobile],0,3)+"****"]", I hope in the exporting file, this column show [source.Mobile] without modify, please help.

Comments

  • edited 1:24AM
    ahdung wrote: »
    a TextObject, its Text is "[Substring([source.Mobile],0,3)+"****"]", I hope in the exporting file, this column show [source.Mobile] without modify, please help.
    you can use like this [Substring("[source.Mobile]",0,3)+"****"]
  • Hello!

    In the designer, add the IsExport parameter (System.Boolean, default value false) and a BeforePrint handler for your TextObject (for example, TextMobile):

    private void TextMobile_BeforePrint(object sender, EventArgs e)
    {
    bool isExport = (bool)Report.GetParameterValue(“IsExport”);
    string mobile = Convert.ToString(Report.GetColumnValue(“source.Mobile”));
    if (isExport)
    {
    TextMobile.Text = mobile;
    }
    else
    {
    TextMobile.Text = (!string.IsNullOrEmpty(mobile) && mobile.Length >= 3)
    ? mobile.Substring(0, 3) + “****”
    : mobile;
    }
    }
    

    For programmatic export, set IsExport = true before calling Prepare():

    report.Load(“report.frx”);
    report.RegisterData(data, “source”);
    report.SetParameterValue(“IsExport”, true);
    report.Prepare();
    report.Export(new FastReport.Export.OoXML.Excel2007Export(), “export.xlsx”);
    
This discussion has been closed.