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
 export worksheet function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

daveblaw

USA
Posts

Posted - 06/05/2006 :  6:03:57 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): OriginPro 7 SR4
Operating System:XP

I am having trouble exporting my worksheet. Below is the expression I pulled out of the help files. I have tryed to compile in this format and every other concievable variation of the parameters:

bool myExport(string strFileName, string strWksName = "");

this is the error I get:

Error, Variable "string strFileName" not declared
or
Error, invalid identifier, check using as name:string strWksName

I have tried declaring the variable before calling myExport and I added the header file.h
thanks


Deanna

China
Posts

Posted - 06/05/2006 :  10:03:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I can see that the function you mentioned is in the OriginLab Sample folder (...\OriginLab\OriginPro7\Samples\Programming\binfile.c).

I opened it in the code builder, added it to the workspace, compiled it and run it like:
myExport("f:\temp\TestOutput.txt", "data1")
The worksheet was exported successfully.

Will you please try again? If you still have problems in exporting, please tell us. :)

Deanna
OriginLab GZ Office
Go to Top of Page

daveblaw

USA
Posts

Posted - 06/06/2006 :  5:43:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I got the export function to work, then i realized it was only used for exporting binary data. I need to export or save my finished worksheet back into a new txt file. So far i haven't been able to find out how to do this. Thanks again for the help
Go to Top of Page

Deanna

China
Posts

Posted - 06/06/2006 :  10:46:16 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Do you mean saving the whole worksheet? I don't know what you want to save in the TXT file. However, the whole worksheet can be saved as an OGW, by calling a labtalk command

Layer lay = Project.ActiveLayer(); //We assume that the worksheet is the active layer
lay.LT_execute("save -i f:\\temp\\test2.ogw");


I hope this will help.




Deanna
OriginLab GZ Office
Go to Top of Page

easwar

USA
1965 Posts

Posted - 06/06/2006 :  11:13:03 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:

I need to export or save my finished worksheet back into a new txt file.



Hi daveblaw,

In 7.5 there is an ExportASCII method in wks class.

In 7.0, you could use code such as below to call back to LabTalk script to export wks to ascii.

Easwar
OriginLab


void wks_export_ascii()
{
Worksheet wks = Project.ActiveLayer();
if(wks)
{
// Some file name - you could bring up file dialog here to get name from user
string strFileName = "c:\\temp\\mywks.txt";
// Point to LabTalk wks object and set properties
// See LabTalk language reference for information on properties
using LTwks = LabTalk.wks;
LTwks.export.c1 = 1;
LTwks.export.c2 = 0;
LTwks.export.r1 = 1;
LTwks.export.r2 = 0;
LTwks.export.cntrl = 1;
LTwks.export.separator$ = ",";
// Issue LabTalk script command to save active page to disk
string strLTCMD;
strLTCMD.Format("save -wh %s %s", wks.GetPage().GetName(), strFileName);
LT_execute(strLTCMD);
}
}


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