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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

using comments to split sections of a document

Thread ID:

Created:

Updated:

Platform:

Replies:

116586 Jun 12,2014 01:07 PM UTC Jul 9,2014 10:38 AM UTC ASP.NET Web Forms (Classic) 3
loading
Tags: DocIO
Paul Griffiths-DUPLICATE ACCOUNT- USE DT# 147667
Asked On June 12, 2014 01:07 PM UTC

Hi!

I have been trying to group sections of my document into "clumps", so I can re-order the document at runtime depending on user grouping (for mail merge).

I initially tried to use bookmarks, because of the bookmark navigator and the ability to select a bunch of the document as a bookmark, but this approach has been dropped as bookmark contents cannot contain section breaks.

Now I'm looking at using comments to select the regions of the document as the comments can include section breaks. Basically, I require regions in my document that match the names of my data tables in my data set pre mail merge. I can name the regions with the comments just fine, so I can find them, but I don't seem to be able to get the actually contents of the document that the comments surround so that I can build a new document in my order from the commented sections.

Is this not possible? Is there another way to achieve what I'm trying to do that is simpler?

Any help here would be greatly appreciated.

Thanks


Paul



Sathish K [Syncfusion]
Replied On June 16, 2014 12:22 PM UTC

Hi Paul,

 

Thank for your interest in Syncfusion products.

 

If your requirement is to copy the sections of the source document to the destination document, then it is not necessary to use the Bookmark navigator and comments. You can directly iterate the sections of the source document, clone the sections and add that in the destination document. Kindly use the below code to clone the sections.

 

Code snippet:

WordDocument source = new WordDocument("SourceFile.docx");

WordDocument destination = new WordDocument();

destination.EnsureMinimal();

foreach (WSection section in document.Sections)

{

destination.Sections.Add(section.Clone());

}    

 

Please refer the below UG documentation link to know more about clone and merge.

http://help.syncfusion.com/ug/asp.net/docio/default.htm#!documents/cloningandmerging.htm

 

You can also reorder the sections based on the index while adding the sections to the destination document.

 

Please let us know if you have any other questions.

 

Regards,

Sathish      


Paul Griffiths-DUPLICATE ACCOUNT- USE DT# 147667
Replied On July 8, 2014 01:30 PM UTC

Thanks for getting back to me.
I probably didn't explain my problem very well. I did try this approach as one of my first, the problem for me being that sections do not define the end of a bookmark region. This could end midway through a section.
I have found an alternative solution now.

If I could ask a question about the mail merge data set syntax though that isn't covered in the documentation:

Command entry: ID=%Table2Name.ID% for Table1Name is fine and groovy, but what syntax would i use where the table names and column names have spaces. e.g.

My Column Name = %Table 2 Name.My Column Name%

or should i be using the t-sql syntax of:

[My Column Name] = %[Table 2 Name].[My Column Name]%

Hope you can help again.

Cheers

Paul

Sarathkumar V [Syncfusion]
Replied On July 9, 2014 10:38 AM UTC

Hi Paul,

 

Thank you for your update.

You could use the same syntax for the table and column names with spaces, you don’t need to use t-sql syntax at all.


 Ex:
My Column Name = %Table 2 Name.My Column Name%

For your reference we have prepared the sample with the Dataset contains DataTable with space in table and column names and which is used during the mail merge process. For your reference we have attached sample for the same.

 

Please let us know if you have any questions.

 

Regards,

Sarath
Attachment: mailMergeSample_82ec4108.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;