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 Forum for Programming
 Forum for Origin C
 export worksheet function

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

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
daveblaw Posted - 06/05/2006 : 6:03:57 PM
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


4   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 06/06/2006 : 11:13:03 PM
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);
}
}


Deanna Posted - 06/06/2006 : 10:46:16 PM
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
daveblaw Posted - 06/06/2006 : 5:43:00 PM
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
Deanna Posted - 06/05/2006 : 10:03:01 PM
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

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