Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
New Member Ben
New Member
Posts: 7
Registered: ‎08-19-2014

Mail Merge grid cannot handle line feeds/Carriage Returns

I have a Mail Merge Word Template for a sales order that reads in fields from Opportunity Product which includes a list of products on the opportunity.

 

The problem occurs when I try and export a memo field into a grid/table into the document. If the field contains carriage returns [ char(13) ] the table becomes a mess because it treats each paragraph of the memo field as a new cell.

I've tried replacing Char(13) with Char(10) and Char(11) [soft-return] but the next row still starts at the first column of the grid instead of following the description column. 

 

Sadly I need the format of this template specific to an existing document and this format won't do.

 

I've found an article on crm.ittoolbox. com which describes the same issue in 2010 but with no fix.

 

Has anyone found a get-around?

 

Cheers,

 

Ben

Silver Super Contributor
Posts: 801
Registered: ‎03-24-2009

Re: Mail Merge grid cannot handle line feeds/Carriage Returns

Wouldn't the replacement be chr(13) + chr(10) ? (CR+LF) [as chr(11) is a vertical tab.

 

So:

 

string = string + chr(13) + chr(10)

 

or

 

replace(string, chr(10),chr(13)+chr(10))

New Member Ben
New Member
Posts: 7
Registered: ‎08-19-2014

Re: Mail Merge grid cannot handle line feeds/Carriage Returns

Thanks for replying Mike,

 

I get the same result with replace(string, chr(10),chr(13)+chr(10)) where the column structure is being lost on merge.

 

 

Instead of following the column format it jumps to the first column on line break or carriage return or any combination of both. The format overflows correctly when they are replaced with ' '. 

 

See this screenshot to see what I mean...

 

 

Cheers

 

Ben

New Member Ben
New Member
Posts: 7
Registered: ‎08-19-2014

Re: Mail Merge grid cannot handle line feeds/Carriage Returns

If you replace char(10) + Char(13) with a tilde (~) Then, through Word perform a Find & Replace on '~' with '^p' this will introduce a carriage return on that character which is precisely what I require...Unfortuantely I cannot find a way to invoke Find and Replace automatically in the Word embedded into SLX.

Highlighted
New Member Ben
New Member
Posts: 7
Registered: ‎08-19-2014

Re: Mail Merge grid cannot handle line feeds/Carriage Returns

Wrote the table directly into Word through vbscript and the column format was still broken at the CR/LF, giving up and writing a button to launch a .net report instead.