You coulduse Origin's Array class ..
Try something like
void UsingWorksheetPageArray(int NumPages)
{
Array<PageBase&> wPages;
if(PopulatePageArray(wPages,NumPages)==NumPages)
{
for(int i=0;i<NumPages;i++)
{
WorksheetPage wPg=wPages.GetAt(i);
if(wPg.IsValid()==true)
{
out_str(wPg.GetName());
}
}
out_str("Success");
}
else
{
out_str("Failure");
}
}
int PopulatePageArray(Array<PageBase&> &wPages, uint NumPages)
{
wPages.SetSize(0);
for(int i=0;i<NumPages;i++)
{
WorksheetPage wPg;
wPg.Create("Origin.otw",CREATE_HIDDEN);
if(wPg.IsValid()==true)
{
WorksheetPage *pwPg;
pwPg=new WorksheetPage(wPg);
wPages.Add(*pwPg);
}
}
return (wPages.GetSize());
}