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 ASCII long names and columns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cab0008

25 Posts

Posted - 06/24/2010 :  1:41:59 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Penn

China
644 Posts

Posted - 06/24/2010 :  11:12:07 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

cab0008

25 Posts

Posted - 06/29/2010 :  12:25:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks alot! This works great I had just forgotten about the | symbol.
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