Sign In  Sign Up Live-Chat

Dinner Invitation demo

Last post 04-30-2008, 6:05 AM by alexey.noskov. 17 replies.
Page 1 of 2 (18 items)   1 2 Next >
Sort Posts: Previous Next
  •  04-24-2008, 9:45 PM 124047

    Dinner Invitation demo

    Hi there,

    I'm working on a task which is smiliar to Dinner Invitation demo, but I need to change the content of the invitation for each Invitee. Please send me some sample or suggestion.

    Thanks,

    Saravanan


    This message was posted using Page2Forum from Simple Mail Merge Explained - Aspose.Words for .NET and Java
     
  •  04-25-2008, 5:18 AM 124082 in reply to 124047

    Re: Dinner Invitation demo

    Hi

     

    Thanks for your request. There is used mail merge feature. So you can change the template to your needs. Please see the following link to learn how to prepare template.

    http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/preparing-a-document.html

     

    Also see the following link to learn more about mail merge.

    http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/simple-mail-merge-explained.html

     

    Best regards.


    Alexey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  04-25-2008, 11:20 AM 124165 in reply to 124082

    Re: Dinner Invitation demo

    Thanks for the reply.

    Look into the Dinner Invitation Demo code attached....

    //Open the template document

    Document doc = new Document(System.IO.Path.Combine(DocPath, "DinnerInvitationDemo.doc"));

    //Example of a very simple mail merge to populate fields only once from an array of values.

    doc.MailMerge.Execute(

    new string[] { "MyName", "MyTitle", "MyAddress1", "MyAddress2" },

    new object[] { "James Bond", "Secret Agent", "MI5 Headquarters", "Milbank, London" });

    //Mail merge customer details from DataTable to the document.

    //Whole document content will be repeated for each record.

    DataTable customers = ExecuteDataTable("SELECT TOP 5 * FROM AsposeWordCustomers WHERE Country = 'USA'");

    doc.MailMerge.Execute(customers);

    return doc;

    In the above code in first "doc.MailMerge.Execute" is fixed data, and the second one has different invitee's address.

    My need is for each Invitees I should change the data/content.

    Please send me some sample/Demo code.

     

    Thanks,

    Saravanan

     

     
  •  04-25-2008, 1:32 PM 124188 in reply to 124165

    Re: Dinner Invitation demo

    Attachment: Present (inaccessible)

    Hello Saravanan!

     

    I added a new merge field to the document from our demo. Please see my attachment. Its name is MessageBody. Now you can add appropriate values to the data source and try mail merge on the modified document:

     

    new string[] { "MyName", "MyTitle", "MyAddress1", "MyAddress2", "MessageBody" },

    new object[] { "James Bond", "Secret Agent", "MI5 Headquarters", "Milbank, London", "Hey, let’s have a party on Friday!" });

     

    Hope this helps.

     

    Regards,
    Viktor Sazhaev
    Software Engineer, Aspose Auckland Team
     
  •  04-25-2008, 4:02 PM 124221 in reply to 124188

    Re: Dinner Invitation demo

    Thanks for the quick reply.

    My need is I should be able to change the message for each person/Invitees.

    Question 1.

    For example, if I want to designate parking spot, how to do that?

    Hey, let’s have a party on Friday.
    Note: Please park your car at parking spot # << mergeField>>.

    Question 2.

    This code is from the Demo..

    DataTable customers = ExecuteDataTable("SELECT TOP 5 * FROM AsposeWordCustomers WHERE Country = 'USA'");

    doc.MailMerge.Execute(customers);

    Here, the mail merge fields are Simple MailMerge, how can I add MergeRegion? Also I would like to show some data in tabular formate (TableStart:tbName and TableEnd:tbName).

    Please send me a sample code.

    Thanks,

    Saravanan

     

     

     

     
  •  04-26-2008, 4:42 AM 124253 in reply to 124221

    Re: Dinner Invitation demo

    Hi

     

    Thanks for your inquiry.

     

    1. Just insert merge field and add field with same name to data source (DataTable for example) that you use for merging.

     

    2. If you want to dynamically grow portions inside the document, then you should use mail merge with regions. Please see the following links for more information.

    http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/mail-merge-with-regions-explained.html

     

    Best regards.


    Alexey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  04-26-2008, 5:51 PM 124258 in reply to 124253

    Re: Dinner Invitation demo

    See my sample code in the next reply..

     
  •  04-26-2008, 5:55 PM 124260 in reply to 124258

    Re: Dinner Invitation demo

    Attachment: Present (inaccessible)

    Hi there,

    Here with attaching my code and template. You can find my templat at "C:\Correspondence\Bin\WordTemplates". I'm using VisualStudio TemaEdition's UnitTesting. Please open the unit test and run the Master2(). You should see 3 documents in single file. For each document I need to add some information in Table format.

    I did not add data for the table, please update my code as you wish.

    Thanks,

    Saravanan

     
  •  04-27-2008, 5:53 AM 124272 in reply to 124260

    Re: Dinner Invitation demo

    Attachment: Present (inaccessible)

    Hi

     

    Thanks you for additional information. I created sample application for you. Please see the attachment. I hope this could help you.

     

    Best regards.


    Alexey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  04-28-2008, 12:13 PM 124438 in reply to 124272

    Re: Dinner Invitation demo

    Hi Alexey,

    thanks for the reply.

    I looked at your sample, it runs fine but it did not meet my requirement. It just repeats the same data/content on all 10 pages. My need is each page has diferent data in table format.

    For example let us take a phone company, which has 10 customers. Month end it generates invoice for all 10 customers with their call information in a tabular format. It creates and saves in a single file, then prints and mails.

    The invoice/bill contains the following.....

     Mailing address which is different for each customer and call details and the total bill amount including the tax (this data also different for each customer).

    Please send me a sampel for this scenario.

    Thanks,

    Saravanan

     

     

     
  •  04-28-2008, 3:49 PM 124480 in reply to 124438

    Re: Dinner Invitation demo

    Attachment: Present (inaccessible)

    Hi

     

    Thanks for your request. I think you can try using MergeField event handler and two templates to achieve this. I created sample application for you. See attachment.

     

    Best regards.


    Alexey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  04-28-2008, 9:05 PM 124526 in reply to 124480

    Re: Dinner Invitation demo

    Thanks Alexey,

    your code helped me a lot to proceed with my task. I have a question.

    How to do page break, I have multi pages and all document always should start on next ew page.

    Let us say , each page is 1 and 1/2 pages. So my second document should start on 3rd page.

    Please send me an sample.

    Thanks,

    Saravanan

     
  •  04-28-2008, 10:14 PM 124531 in reply to 124526

    Re: Dinner Invitation demo

    Hi Alexey,

    My user prefers to have everything in one single template including the table. Can you please send a sample with single template.

     

    Thanks,

    Saravanan

     
  •  04-29-2008, 3:55 AM 124557 in reply to 124531

    Re: Dinner Invitation demo

    Attachment: Present (inaccessible)

    Hi

     

    Thanks for your request.

     

    1. Please see the following link to learn how to control new pages during mail merge.

    http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/how-to-control-new-pages-during-mail-merge.html

     

    2. I modified my example a little. Please change code of MergeField event handler

     

    static void MailMerge_MergeFieldAddTable(object sender, Aspose.Words.Reporting.MergeFieldEventArgs e)

    {

        if (e.FieldName == "TablePlaceHoleder")

        {

            //Get data

            DataTable tableData = GetEntityInfo(_currentID);

            _currentID++;

            //Execute mail merge with regions

            e.Document.MailMerge.ExecuteWithRegions(tableData);

            Paragraph parentParagraph = e.Field.Start.ParentParagraph;

            //Remoce parent paragraph;

            parentParagraph.Remove();

        }

    }

     

    And try using the attached template.

     

    I hope this could help you.

     

    Best regards.


    Alexey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  04-29-2008, 12:55 PM 124677 in reply to 124557

    Re: Dinner Invitation demo

    Thanks Alexey,

    your code works with "TablePlaceHoleder" merge field,

    1. Is there any way to make it work without this field?

    2. I prefer to make ReadOnly on some paragraphs and I know to do this using "ProtectedForForms" on sections. But my user wants to create BeginReadOnly and EndReadOnly merge fields between the readonly paragraphs. How can I do that?

    3. Also I have few lines, assuem that 10 bullte points on the templat and they want to hide some of them. Once it is hidden, the hidden lines should not have blank spaces. How to do that?

    Please send me some sample code.

    Thanks,

    Saravanan

     
Page 1 of 2 (18 items)   1 2 Next >
View as RSS news feed in XML