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中文论坛
 Origin 中文论坛 (Chinese Origin Forum)
 Origin C: 创建一个5列5行的工作表

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 [?]

 
   

T O P I C    R E V I E W
vickey Posted - 05/13/2016 : 03:00:45 AM
Origin C 第一弹: 创建一个5列5行的工作表


void create_worksheet()
{
WorksheetPage wp; // 分配工作簿空间给wp
wp.Create("Origin"); // 创建一个基于Origin内置模板的工作簿
//拿到第一个工作簿
Worksheet wks(wp.Layers(0));
//设置行位50 列为5
int nRows = 50;
int nCols = 5;
if(!wks.SetSize(nRows, nCols))
{
printf("Failed to set size of %s!\n", wks.GetName());
}
}
在Origin中,要对列或者行进行操作,必须先找到列和行所在的工作表,工作表所在的工作簿,这样按照工作簿-》工作表-》列,行=》单元格这个层级次序进行调用就OK了。


相关参考:


Page类下面包含的Member:
http://originlab.com/doc/OriginC/ref/Page-Class


WorksheetPage:工作页
http://originlab.com/doc/OriginC/ref/WorksheetPage-WorksheetPage


Create: 创建图页,矩阵页,工作簿页以及布局页
http://originlab.com/doc/OriginC/ref/Page-Create


第一次写,大家多多包涵,会一次比一次写的好的!


代码有错误或者大家有自己的想法和使用心得,求指出和分享!


谢谢!
3   L A T E S T    R E P L I E S    (Newest First)
Echo_Chu Posted - 06/12/2016 : 10:56:02 PM
建议你去看看Origin C的帮助, 上面有Origin C Programming Guide和各种example. 例如下面这页, 正好对应你问的问题的example.

http://www.originlab.com/doc/OriginC/examples/Column-Name-and-Labels
Sophy Posted - 06/12/2016 : 10:15:40 PM

void	test_labels()
{
	Worksheet wks = Project.ActiveLayer();
	if ( wks )
	{
		Grid gg;
		gg.Attach(wks);
		vector<int> vnTypes;
		gg.GetShowLabels(vnTypes);
		//show it only when it is hidden, then later set labels for the first column
#define	CHECK_ADD_LABEL(_Type) if ( !gg.IsLabelsShown(_Type) )vnTypes.Add(_Type);
		CHECK_ADD_LABEL(RCLT_PARAM);
		CHECK_ADD_LABEL(RCLT_PARAM);
		CHECK_ADD_LABEL(RCLT_UDL);
		gg.SetShowLabels(vnTypes);
		
		Column colA(wks, 0);
		colA.SetExtendedLabel("User Comments", RCLT_COMMENT);
		colA.SetExtendedLabel("Parameter", RCLT_PARAM);
		colA.SetExtendedLabel("Parameter 2", RCLT_PARAM + 1);
		colA.SetExtendedLabel("User Defined Parameter", RCLT_UDL);

		return;
	}
}
HeatSink Posted - 06/12/2016 : 06:44:10 AM
quote:
Originally posted by vickey
Origin C 第一弹: 创建一个5列5行的工作表


楼主有没有涉及用OC获取和设置Parameter或User Parameter等标题行的数据?
英文版里翻遍了,都是用LT,但LT太变态,跟机器码差不多。。。

Vouloir, c'est pouvoir.

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