The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 New line in Worksheet comment section.

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
hschausb Posted - 01/17/2021 : 07:33:12 AM
Origin Ver. and Service Release (Select Help-->About Origin): 2020b
Operating System: Win 10

Hello fellow programmers.
How does one set a \n inside the comment section of a Worksheet?
If I want to save a string inside the comment section of my worksheet all characters are lined behind each other without acknowledging the presence of “\n” and therefore no new line.
Is it possible to set a new line in the comment section?

My programm looks like this.

WorksheetPage test = Project.WorksheetPages("Book1");
Worksheet wks = test.Layers(0);
char str[] = 
 “Buddy, you're a boy, make a big noise\n
 Playing in the street, gonna be a big man someday\n
 You got mud on your face, you big disgrace\n
 Kicking your can all over the place, singin'\n
 We will, we will rock you\n
 We will, we will rock you\n”
;

test.SetComment(str);
}

Output:
Buddy, you're a boy, make a big noise Playing in the street, gonna be a big man someday You got mud on your face, you big disgrace Kicking your can all over the place, singin' We will, we will rock you We will, we will rock you


You get the idea how it should be presented at the initiation. This is a representative example and not my real program.

So again: Is it possible to set a new line in the comment section?

4   L A T E S T    R E P L I E S    (Newest First)
hschausb Posted - 01/18/2021 : 4:28:23 PM
Oh no. It would have been so easy.
Well. Today I learned.

Thanks again. Helped alot.
cpyang Posted - 01/18/2021 : 3:09:34 PM
string should be much easier and no need to use strcat, strcpy, like

string str="abc";
string str1="efg";
str += " ";
str += str1;



and strcpy you just make assigment

str1 = str;


CP
hschausb Posted - 01/18/2021 : 11:57:07 AM
Thank you very much CPYANG. It works fine now.

quote:

Assuming you have no issue with using string instead of char [].



Actually, yes I do. I am using a char due to the fact that a string cannot function with most “strcat” methods. The string is gradually build together over time via the “strcat” and some “strcpy” methods. And I cannot concatenate a string onto/after a string. I have to use char in the form of a sting to use these commands.

I do not know if it is due to a missing NULL terminal in the string or due to the fact, that a string cannot change its size after first initialisation (I am assuming this). But it does not work with “string” data types. Wasted a couple of hours finding this out.

Anyway. Thanks again.
.
cpyang Posted - 01/17/2021 : 3:51:57 PM
Origin use "\r\n" for new line, so add the CR character, or replace like the following:

WorksheetPage test = Project.WorksheetPages("Book1");
string str= 
 "Buddy, you're a boy, make a big noise\n"
 "Playing in the street, gonna be a big man someday\n"
 "You got mud on your face, you big disgrace"
 "Kicking your can all over the place, singin'\n"
 "We will, we will rock you\n"
 "We will, we will rock you\n"
;
str.Replace("\n", "\r\n");
test.SetComments(str);


Assuming you have no issue with using string instead of char [].

CP

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000