Normal Topic What end-of-line character(s) to use with paste? (Read 591 times)
Rick_R
Full Member
***
Offline



Posts: 243
Joined: Jan 29th, 2010
What end-of-line character(s) to use with paste?
Apr 23rd, 2011 at 3:30am
Print Post Print Post  
I have set up a routine that pulls data from various fields, adds tabs, field names and newlines, creates a string and stores it in the Windows clipboard.  The idea is to create a record summary that can be pasted into wordprocessing documents, emails, etc.

So, for instance, the output should look like this (with formatting characters shown below in square brackets):

Patient Name: Harry Smith[newline]
     Admit date: 11/18/2009[newline]
     Account No: 123456[newline]
     Amount: $1234.56[newline]
[newline]
     Total of Accounts: $3456.78[newline]
     Discharge date: 11/20/2009[newline]

I am running into problems when I then paste the clipboard to various Microsoft programs.  Using @Newline(), Notepad simply ignores the newlines completely.  Word 2007 adds a blank line at the end of each line. I don't use Outlook, but it probably also does not handle the newlines correctly.

The users will normally want to paste either into Word 2003 or an Outlook 2003 email.

When I first put this together and ran into the blank-lines problem I tried creating a text file in Notepad and pasting that into Word 2007 and also ran into the blank-lines problem.  What happens in Word is that when the text is pasted it considers each line to be a paragraph (which is technically correct because of the CRLF) and it automatically adds a blank line at the end of the paragraph.  The only way to remove the blank lines is either to manually join two lines and then use Shift+End or to hi-lite the whole group, select Format, and remove the "add blank lines between paragraphs".  Either way is a real pain for the users and basically kills the usefulness of "Click Generate Summary, Alt-Tab to Word, Paste."

The Sesame part seems to generate the string as intended. Any suggestions on how to paste so it works as intended?  I don't want to start writing Word macros, etc.  A lot of our users aren't even familiar with Windows Explorer for managing files.
  
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: What end-of-line character(s) to use with past
Reply #1 - Apr 23rd, 2011 at 4:41am
Print Post Print Post  
Rick,

I believe you want to replace @nl() in your sesame text with %0D%0A. (That's percent-zero-capital D-percent-zero-capital A)

You can see an example of putting text from Sesame into a Windows Email program here:

http://www.lantica.com/support/kb/article/000119

Hope that helps you out.

Happy Easter,

Steve
  
Back to top
IP Logged
 
Rick_R
Full Member
***
Offline



Posts: 243
Joined: Jan 29th, 2010
Re: What end-of-line character(s) to use with past
Reply #2 - Apr 23rd, 2011 at 7:43pm
Print Post Print Post  
The %0D%0A are just the CRLF characters.  From what I can tell, under Windows @newline() uses that as EOL.

I tried replacing @newline() with just @chr(13) and it didn't matter.

I did find a way to get it to work with Word 2007 but it involves changing a bunch of defaults in Word and with the politics in our company that could be a big problem.  However, as a practical matter, there is no telling when--if ever--we might make the switch replacing part of the QA app with this, so it's not something I have to deal with at the moment.

It looks like the defaults for Word are that it automatically adds a 10 pt. blank line after each paragraph.  Word 2007 defaults to left-justified, Calibri font with line spacing at 1.15.  (I always wondered why when I port WordPerfect documents to Word they always seem to take more space.)  When I set it to Times New Roman with nothing added after a paragraph it works like I would expect.  Of course, that doesn't help Outlook, which, I believe, generates an HTML variant that automatically inserts a blank line between paragraphs.
  
Back to top
 
IP Logged