The Origin Forum
File Exchange
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
 All Forums
 Origin Forum for Programming
 Forum for Automation Server/COM and LabVIEW
 How can I iterate the WorksheetPages?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

yanfeng39

1 Posts

Posted - 09/08/2013 :  05:37:37 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.5
Operating System: win7 x64
Hi,
I'm using Origin automation Server in C++ (VS2010). I encountered a problem that when I'm trying to access the count of worksheetPages it doesn't work fine. How can I iterate the WorksheetPages?

Here is the code:

WorksheetPagesPtr WksPagesPtr;
WorksheetPagePtr WksPagePtr;

WksPagesPtr=m_pClient->operator ->()->GetWorksheetPages();
for (long idx=0;idx<WksPagesPtr->Count;idx++)//error!
{
WksPagePtr=WksPagesPtr->Item[idx];
...
}

Penn

China
644 Posts

Posted - 11/18/2013 :  02:11:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I have tried the following code, and it works.

CoInitialize(NULL);
{
	OriginApp::IOApplicationPtr pOrigin = NULL;
	pOrigin.CreateInstance(__uuidof(ApplicationSI));
	pOrigin->Visible = OriginApp::MAINWND_VISIBLE::MAINWND_SHOW;

	OriginApp::WorksheetPagesPtr wksPagesPtr;
	OriginApp::WorksheetPagePtr wksPagePtr;
	wksPagesPtr = pOrigin->WorksheetPages;
	int nCount = wksPagesPtr->Count;

	for(long i = 0; i < wksPagesPtr->GetCount(); i++)
	{
		wksPagePtr = wksPagesPtr->GetItem(i);
		cout << wksPagePtr->GetName();
	}
}
CoUninitialize();


Penn
Go to Top of Page

robertodumas

Mexico
2 Posts

Posted - 03/16/2016 :  11:54:08 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
yes..taht script works like magic..! Thxs Penn..I used to have the same problem....just copy & paste the script and the problem is gonna take away





http://cancelesusdeudas.blogspot.mx/
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 © 2008 Originlab Corporation Go To Top Of Page
Snitz Forums 2000