We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Merge Fields with '':'' do not enumerate

Is it possible to fix it so Merge Fields in a pre-existing Word document with the character ':' in them get processed properly before the next release?

I have a merge field named "Business : City". Tried "Business - City" and that works ok. But I need to support ':'.

Thanks.

6 Replies

JH Josh H May 5, 2007 04:36 AM UTC

I see now that you use the ':' character to detect the presence of a Group Merge field. Does this mean I will have to find a workaround?

Also, another question. I notice in your Sales Invoice sample, you use ExecuteGroup to generate related table information into the document. Your example only shows this with one record.

Will this support multiple records, with child records? If so, what order must I merge.


BP Bhuvaneswari P Syncfusion Team May 8, 2007 12:08 PM UTC

Hi Josh,

Issue1:

Could you please elaborate the issue and could you please provide me the sample to reproduce the issue. This would be very helpful to investigate the issue further.

Issue 2:

Sales Invoice Will this support multiple records, with child records?
This is can be achieved by using the below code snippet,
//Excute MailMerge
doc.MailMerge.Execute(dataReader1);
I have modified the sales invoice sample as your requirement. Herewith I have attached the sample for your reference:
http://websamples.syncfusion.com/samples/DocIO.Windows/F60467/main.htm

Herewith I have attached the sample document for your reference:

Sample.doc

Please take a look into this and let me know if you have any other queries.

Thank you for your interest in Syncfusion products.

Best Regards,
Bhuvaneswari.


JH Josh H May 10, 2007 11:04 PM UTC

Thank you for the sample. However, it does not produce the merge functionality I am curious about. You will notice in your sample that a new and separate invoice is produced for each Order Detail item! Each Order detail item associated with an order should appear on the same invoice page.
That is what I want to know how to do. Could you please create a new sample where all associated order details are on the same invoice?

Thanks, Josh


BP Bhuvaneswari P Syncfusion Team May 14, 2007 10:57 AM UTC

Hi Josh,

Thank you for your update.

I have created a new sample for multiple records.

Herewith I have attached the sample for your reference:
http://websamples.syncfusion.com//samples/DocIO.Windows/F60467_2//main.htm

Herewith I have attached the generated Document.
Sample.doc

Please take a look into this. If it does not meet your requirements, could you please provide me with more details regarding this.

Best Regards,
Bhuvaneswari


JH Josh H May 17, 2007 12:43 AM UTC

I'm sorry, the revised sample is not what I'm looking for.

Again, I would need a separate invoice for each order, not one single invoice with many different orders to different customers.

Assuming each customer needs his/her own invoice for a specific order, a separate invoice showing just his/her order information should be produced.

On different page(s), would be another invoice with the next orders' information, and so on.

I have attached a sample of the output I would expect, providing I have a database structure similar to Northwind.

I hope this clarifies the information.
Thanks for the help.

SyncSampleNeeded.zip


BP Bhuvaneswari P Syncfusion Team May 17, 2007 10:05 AM UTC

Hi Josh,

Thank you for information.

This is not possible to create a separate invoice for each customer. However, this would be possible by using the below workaround, Generate each invoice separately and merge into one document using cloning and merging concept.

Code Snippet:
for (int i = 0; i < listBoxCustomer.SelectedItems.Count; i++)
{
// execute Mail Merge with groups.
doc.MailMerge.ExecuteGroup(GetTestOrder((int)listBoxCustomer.SelectedItems[i])); doc.MailMerge.ExecuteGroup(GetTestOrderTotals((int)listBoxCustomer.SelectedItems[i]));
// Using Merge events to do conditional formatting during runtime.
doc.MailMerge.MergeField += new MergeFieldEventHandler(MailMerge_MergeField);
DataView orderDetails = new DataView(GetTestOrderDetails((int)listBoxCustomer.SelectedItems[i]));
orderDetails.Sort = "ExtendedPrice DESC";
doc.MailMerge.ExecuteGroup(orderDetails);
// Enumerate all the sections from the template document.
foreach (IWSection sec in doc.Sections)
{
// Cloning all the sections one by one and merging it to the new document.
doc1.Sections.Add(sec.Clone(doc1));
// Setting section break code to be the same as the template.
doc1.LastSection.BreakCode = sec.BreakCode;
}
}
doc1.Save("sample1.doc");

Herewith I have attached the sample for your reference:
http://websamples.syncfusion.com//samples/DocIO.Windows/f60467_4/main.htm

Herewith I have attached the generated document for your reference:
sample1.doc

Please take a look into this and let me know if you have any other queries.

Best Regards,
Bhuvaneswari.


Loader.
Live Chat Icon For mobile
Up arrow icon