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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Longname Font style
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Eddie-88

Germany
2 Posts

Posted - 07/16/2014 :  12:26:32 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Shirley_GZ

China
Posts

Posted - 07/18/2014 :  03:04:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000