Change PreparedPages text

Keve G??borKeve G??bor hungary
edited 2:32PM 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 2:32PM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.