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

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 New Analysis Sheet Creation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Drbobshepherd

USA
Posts

Posted - 06/21/2012 :  12:05:41 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 8.6.0 SR3
Operating System: Windows XP

I am trying to add a new sheet to my workbook, using one of my analysis templates, but Origin won't let me.

In my case, the template is named TimeAtAlt.ogw. It is a workbook with one worksheet. The following command works fine for creating a new workbook:

newbook template:=TimeAtAlt.ogw;

But, when I try to add a worksheet, using the following:

newsheet template:=TimeAtAlt.ogw sheet:=Sheet1;

I get an Attention Box that says,"Format error ocurred during reading. File may be damaged."

Is this right? Origin cannot create analysis worksheets using templates, only analysis workbooks?

And if so, how does one add analysis worksheets using an existing template?

Kathy_Wang

China
143 Posts

Posted - 06/26/2012 :  02:31:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

An analysis template is a workbook(.ogw format), so you could only create new workbook from analysis template.

When you create a new worksheet, the "template" should be .otw format, that's why in your script, there is a format error.

So to add worksheets based on a certain analysis template, you should:
1, Create a new workbook with the analysis template, the workbook contains one worksheet in your case;

2, Add an empty new worksheet to the workbook with the default template "Origin", which for example is Sheet2;

3, Copy the content in Sheet1 into Sheet2 with the wcopy command;
the syntax should be
wcopy iw:=[Book1]Sheet1! ow:=[Book1]Sheet2!


In case you need to do some data manipulation in between you creating different worksheets(i.e. your sheet1 is not an empty worksheet any more), you could create a new workbook with the analysis template, and copy the worksheet similarly with wcopy.

For more information of the x function wcopy, you may refer to:
http://www.originlab.com/www/helponline/Origin/en/Programming/mergedProjects/X-Function/X-Function/Wcopy.html

Hope this information helps!

Kathy
Originlab

Edited by - Kathy_Wang on 06/26/2012 02:39:55 AM
Go to Top of Page

Drbobshepherd

USA
Posts

Posted - 06/27/2012 :  10:38:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Kathy,

Thank you. Your suggestion to use wcopy worked great.

Actually, I found your second suggestion more efficient ("In case you need to do some data manipulation in between you creating different worksheets(i.e. your sheet1 is not an empty worksheet any more), you could create a new workbook with the analysis template, and copy the worksheet similarly with wcopy.")

Because all my Analysis worksheets were the same, I just

(1) created a workbook with my Analysis template, and then

(2) used wcopy in a loop to create as many Analysis worksheets as I needed.

I found I could even do this after running an analysis because wcopy has a "copydata:=0" option that creates copies without data.

Thanks again,
DrBobShepherd
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