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
 Longname Font style

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
Eddie-88 Posted - 07/16/2014 : 12:26:32 PM
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 9.0.1 SR2
Operating System: Win7

Hey,
how can i set the font style of the longname to bold? Is there something like Column.SetWidth()?
thank you,
Eddie
1   L A T E S T    R E P L I E S    (Newest First)
Shirley_GZ Posted - 07/18/2014 : 03:04:08 AM
Hi,

Please run the below script:


void apply_cell_format(int nRowIndexOfLongNameLabel = -4)
{
	Worksheet wks = Project.ActiveLayer();  
	if( !wks )
	{
		printf("Please keep worksheet active before running.\n");
		return;
	}
	
	Tree tr;    
	tr.Root.RangeStyles.RangeStyle1.Style.Font.Bold.nVal = 1;
	tr.Root.RangeStyles.RangeStyle1.Left.nVal = 1;
	tr.Root.RangeStyles.RangeStyle1.Top.nVal = 1;
	tr.Root.RangeStyles.RangeStyle1.Right.nVal = 1;
	tr.Root.RangeStyles.RangeStyle1.Bottom.nVal = 1;
	tr.Root.CommonStyle.Font.Bold.nVal = 1;
	
	                  
	DataRange dr;
	int c1 = 0, c2 = 1;
	dr.Add( "Range1", wks, nRowIndexOfLongNameLabel, c1, nRowIndexOfLongNameLabel, c2);

	// apply the format
	if( 0 == dr.UpdateThemeIDs(tr.Root) )
	{
		bool bRet = dr.ApplyFormat( tr, true, true );                        
	}		
}



In this script, the index of first row of data is 0, you can count upward, then the index of long name is -4, see the screenshot, so I set nRowIndexOfLongNameLabel = -4 in the first line.




You can find more example here, http://www.originlab.com/doc/OriginC/examples/Formatting



Originlab Technical Service Team

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