Merge Reports

13 posts, 1 answers
  1. Rieni De Rijke
    Rieni De Rijke avatar
    170 posts
    Member since:
    Mar 2010

    Posted 10 Nov 2011 Link to this post

    The RichTextBox has got a great merge-function.
    We are very pleased with this feature.

    Now and then we need a sort of master-detail possibility in our merge-letters.

    Think about a mailmerge-letter to your customers.
    We could use the mergefields for name, address and so on.
    But you would like to use a mergefield to view a list of orders which is different for every customer. Master-detail!

    Have you thought about something like that?

    And how about combining the mailmerge in the RichTextBox with Telerik Reporting?
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 14 Nov 2011 Link to this post

    Hello Rieni De Rijke,

    Thank you for the positive feedback.
    We have thought about master-detail mailmerge and we have it on our to-do list. However, the timeline of this feature has not been set yet, so I cannot provide any details of when it is going to be implemented.
    I hope this answers your question.

    Greetings,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Rieni De Rijke
    Rieni De Rijke avatar
    170 posts
    Member since:
    Mar 2010

    Posted 05 Jan 2012 Link to this post

    is there a way to find out when the next post/row in the merge-datasource is going to be used.
    Maybe a type of BeforeNextDataRowEvent or something like that.

    If we know which row is to be used in the merge-process, we could create a table/text and insert it in the document.
  5. Boby
    Admin
    Boby avatar
    595 posts

    Posted 11 Jan 2012 Link to this post

    Hello Rieni De Rijke,
    You can use custom merge fields to achieve such behaviour, as demonstrated in the attached project:
    public class CustomMergeField : MergeField
    {
        private const string CustomFieldName = "CustomField";
     
        static CustomMergeField()
        {
            CodeBasedFieldFactory.RegisterFieldType(CustomMergeField.CustomFieldName, () => { return new CustomMergeField(); });
        }
     
        public override string FieldTypeName
        {
            get
            {
                return CustomMergeField.CustomFieldName;
            }
        }
     
        public override Field CreateInstance()
        {
            return new CustomMergeField();
        }
     
        protected override DocumentFragment GetResultFragment()
        {
            Customer customer = this.Document.MailMergeDataSource.CurrentItem as Customer;
            if (customer == null)
            {
                return null;
            }
     
            if (this.PropertyPath == "Orders")
            {
                Table table = new Table();
     
                foreach (Order order in customer.Orders)
                {
                    Span span = new Span(order.ProductName);
                    Paragraph paragraph = new Paragraph();
                    paragraph.Inlines.Add(span);
     
                    TableCell cell = new TableCell();
                    cell.Blocks.Add(paragraph);
     
                    TableRow row = new TableRow();
                    row.Cells.Add(cell);
     
                    table.AddRow(row);
                }
     
                Section section = new Section();
                section.Blocks.Add(table);
     
                RadDocument document = new RadDocument();
                document.Sections.Add(section);
     
                document.MeasureAndArrangeInDefaultSize();
                return new DocumentFragment(document);
            }
     
            return null;
        }

    Don't hesitate to contact us if you have other questions.


    Greetings,
    Boby
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Rieni De Rijke
    Rieni De Rijke avatar
    170 posts
    Member since:
    Mar 2010

    Posted 11 Jan 2012 Link to this post

    Thank you so much for your ansver and your example-project. Just what I needed.
    I found a way myself using movenext, movenext etc. But this is much better!
  7. Rieni De Rijke
    Rieni De Rijke avatar
    170 posts
    Member since:
    Mar 2010

    Posted 13 Jan 2012 Link to this post

    But...
    I use your eksample and I click the Finish-MailMerge-button. I save the merged document as a word-docx.
    Now when I open the word-document in Word it looks very weird.
    It looks like the lines have been shrinked. I cannot read the text.
    When I open the file in your eksample again, it looks fine.
  8. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 17 Jan 2012 Link to this post

    Hi Rieni De Rijke,

    There was such a bug in one of the internal builds before the service pack. Could you tell us the exact version of the controls you are using, e.g. 2011.3.1220.40, so that we can test the behavior?
    Looking forward to your reply.

    Kind regards,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  9. Rieni De Rijke
    Rieni De Rijke avatar
    170 posts
    Member since:
    Mar 2010

    Posted 17 Jan 2012 Link to this post

     The version of the controls we are using is 2011.3.1116.40.
  10. Answer
    Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 18 Jan 2012 Link to this post

    Hello Rieni De Rijke,

    The bug that I mentioned in my previous post is actually present in the version of the controls you quoted - 2011.3.1116.40. The only solution would be to upgrade to the service pack - 2011.3.1220.40.
    We are sorry for the inconvenience.

    All the best,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  11. Robert
    Robert avatar
    271 posts
    Member since:
    Mar 2011

    Posted 04 Jul 2012 Link to this post

    Hi,

    I've tried your example, but there is no data present in the mail merge list, the document is blank.

    Please see my attached images.

    I'm using Telerik WPF version 2012.2.607.40.

    Thanks,

    Rob
  12. Robert
    Robert avatar
    271 posts
    Member since:
    Mar 2011

    Posted 04 Jul 2012 Link to this post

    Ah I see it does work.

    There's a button labelled Action that I didn't notice.
  13. Ashutosh
    Ashutosh avatar
    1 posts
    Member since:
    Aug 2012

    Posted 27 Oct 2012 Link to this post

    This doesn't work in Silverligth. I tried. As soon as I go in Result Mode and try to type in it removes the data of merge field.
  14. Petya
    Admin
    Petya avatar
    975 posts

    Posted 30 Oct 2012 Link to this post

    Hi Ashutosh,

    We are not observing the behavior you described on our end. Please find attached the same demo project Boby attached below, but converted to Silverlight.
     
    All the best,
    Petya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready