Change PreparedPages text

Keve G??borKeve G??bor hungary
edited 4:39AM in FastReport .NET
Hello!

I would need it, that when preparedpages textobject not contains any text, i want to put a simple 'X' to indicate the user! (Maybe a BIG red X) [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> But this solution doesn't work for me, when i export the prepared document to PDF.[/img]
FastReport.Report fr = new FastReport.Report();
                fr.Load(MemoryStream);

                    fr.Prepare();
                    if (m_isPreview)
                    {
                        for (int j=0; j<= fr.PreparedPages.Count-1; j++)
                        {
                            FastReport.ReportPage frp = fr.PreparedPages.GetPage(j);
                            for (int i = 0; i <= frp.AllObjects.Count-1; i++)
                            {
                                if (frp.AllObjects[i] is FastReport.TextObject)
                                {
                                    if (((FastReport.TextObject)frp.AllObjects[i]).Text.Length == 0)
                                    {
                                        ((FastReport.TextObject)frp.AllObjects[i]).Text = "X";
                                        ((FastReport.TextObject)frp.AllObjects[i]).Visible = true;
                                    }
                                }
                            }
                            frp.Modify();
                            frp.Refresh();
                        }
                    }

thanks!

Comments

  • edited 4:39AM
    Hello,

    Modify and Refresh methods can be used in the event handlers like Click, MouseMove, MouseEnter etc. These methods just set the modify/refresh flag.
    In your case, you need to use the following code to fix changes:

    //frp.Modify();
    //frp.Refresh();
    fr.PreparedPages.ModifyPage(j, frp);

    If you just want to show "X" instead of an empty value, use the TextObject.NullValue property (set it to "X").

Leave a Comment