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
 Code Builder change row style and insert theta

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
michaelbraun Posted - 07/07/2015 : 6:09:12 PM
Origin Ver. and Service Release (Select Help-->About Origin): Origin 2015 sr2
Operating System: Windows 7 and 10

I am trying to use the code builder to set the long name row style to rich text programmatically upon importing data, is there a way to do this? Furthermore, I am trying to name a column as 2θ using the unicode character 03B8, however I cannot get the column name to be 2θ using code builder in either the long name or units row.
4   L A T E S T    R E P L I E S    (Newest First)
michaelbraun Posted - 07/09/2015 : 09:33:31 AM
Worked perfect, thank you! I had the unicode, but I didn't realize you needed the second slash in the string "2\\x(03B8)".
Sophy Posted - 07/08/2015 : 10:33:22 PM
Hi, Michael:
You can try to use escaped unicode, see the following line

string strLongName = "2\\x(03B8)"; //\x(03B8) represent the unicode value of theta

quote:
Originally posted by michaelbraun

Hi, the code worked great for setting rich text style, however I need the unicode theta not the greek style theta. When exporting from origin as a pdf (and then using as a figure in LaTeX) the greek style theta does not render as a theta, however the unicode theta renders correctly. Furthermore, the greek style theta does not match the font of the 2 well, while the unicode theta takes the same font style as the 2 (ie arial). Any thoughts?

michaelbraun Posted - 07/08/2015 : 09:44:47 AM
Hi, the code worked great for setting rich text style, however I need the unicode theta not the greek style theta. When exporting from origin as a pdf (and then using as a figure in LaTeX) the greek style theta does not render as a theta, however the unicode theta renders correctly. Furthermore, the greek style theta does not match the font of the 2 well, while the unicode theta takes the same font style as the 2 (ie arial). Any thoughts?
jasonzhao Posted - 07/08/2015 : 05:06:40 AM
Hello,

Please refer to the function below, which set the format of the long name into Rich Text and set long name=2theta for col(B):


#include <..\OriginLab\theme_utils.h>
void	test_set_greek_in_longname()
{
	Worksheet wks = Project.ActiveLayer();
	if ( wks )
	{
		Tree trFmt;
		trFmt = wks.GetFormat(FPB_ALL, FOB_ALL & ~(FOB_LINK_STYLE|FOB_RANGE_STYLE), TRUE, TRUE);
		TreeNode trTextFmt = theme_tree_get_node_by_name_strval(trFmt, STR_NAMESTYLE_LONG_NAME);
		if ( trTextFmt )
		{
			trTextFmt.Style.Control.strVal = "Origin Text Edit";
			if ( 0 == wks.UpdateThemeIDs(trFmt.Root) )
			{
				wks.ApplyFormat(STYLE_REPAINT | STYLE_RELATIVE | STYLE_UNDO | STYLE_COMPLETE, trFmt);
				//after set as Rich Text, set long name to column
				string strLongName = "2\g(q)";
				Column colB(wks, 1);
				if ( colB )
				{
					colB.SetLongName(strLongName);
					out_str("Please check Long Name of column B");
				}
			}
		}
	}
}


Best regards!
Jason
OriginLab Technical Service

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