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 ASCII long names and columns

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
cab0008 Posted - 06/24/2010 : 1:41:59 PM
Hello, I was wondering if anyone may be able to help me on appending the long names and column labels to the top of exported ascii files. I was hoping that those two labels would take the top two rows when I exported and then would begin the data on the 3rd.

My code written here is to loop through all the pages and create an ascii file for each one stored in a specified folder.



foreach( PageBase pgbs in Project.Pages )
{
if( EXIST_WKS == pgbs.GetType() )
{
WorksheetPage wks(pgbs);
Worksheet works = wks.Layers(0);
string fldr = "C:\SpecifiedPlaceHere\\" + Project.GetName();
CreateDirectory(fldr, NULL);
string strWKSPath = fldr + '\\' + Project.GetName() + '-' + wks.GetName() + ".txt";
printf("File: %s\n", strWKSPath);
// Call function to export page with desired settings
works.ExportASCII(strWKSPath, WKS_EXPORT_ALL);

}
}





I saw that WKS_EXPORT_HEADING and WKS_EXPORT_LABELS are options here http://www.originlab.com/forum/topic.asp?TOPIC_ID=2657 However, they leave my .txt's blank somehow.

Any ideas on how to fix this? Is there a way to use something in labtalk like LT_execute(expASC iw:=wks path:="c:\specified path.txt") with this to fix the problem?




Origin Ver. and Service Release (Select Help-->About Origin): 8.0.63.988 SR6
Operating System: XP
2   L A T E S T    R E P L I E S    (Newest First)
cab0008 Posted - 06/29/2010 : 12:25:02 PM
Thanks alot! This works great I had just forgotten about the | symbol.
Penn Posted - 06/24/2010 : 11:12:07 PM
Hi,

With the code your provided, I add WKS_EXPORT_HEADING and WKS_EXPORT_LABELS to the ExportASCII method, and it works fine, both long names and labels are exported to the file.

	foreach( PageBase pgbs in Project.Pages )
	{
		if( EXIST_WKS == pgbs.GetType() )
		{
			WorksheetPage wks(pgbs);
			Worksheet works = wks.Layers(0);
			
			string fldr = "c:\\SpecifiedPlaceHere\\" ;
			bool bRet1 = CreateDirectory(fldr, NULL);
			if(!bRet1)
				return;
			
			string fldr2 = "c:\\SpecifiedPlaceHere\\" + Project.GetName() + "\\";
			bool bRet2 = CreateDirectory(fldr2, NULL);
			if(!bRet2)
				return;
			
			string strWKSPath = fldr2 + Project.GetName() + '-' + wks.GetName() + ".txt";
			printf("File: %s\n", strWKSPath);
			
			// Call function to export page with desired settings
			int iRet = works.ExportASCII(strWKSPath, WKS_EXPORT_ALL|WKS_EXPORT_HEADING|WKS_EXPORT_LABELS);
			if(iRet == -1)
				out_str("Failed to export!");
		}
	}

Please note one thing, CreateDirectory function can only create one subdirectory in the existing directory. Take a look the code above.

Penn

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