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
 Getting Imported File Paths

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
cdrozdowski111 Posted - 11/28/2013 : 10:08:12 AM
OriginPro 9.1 SR0 64-bit/32-bit, Win7 64-bit, running in VMware Fusion 5.0.3

How can I get the filepath as a string variable of every file that has been imported into worksheets in a project? I have searched both help and the OC source code for how to do this but it isn't clear. In the Organizer for a workbook, there is the "Imported Files" node but I can't figure out how to drill down to get the FilePath from it.

The code would need to be generic enough to handle workbooks with multiple worksheets and worksheets that contain data that wasn't imported.

EDIT:

I created this but am not sure how efficient or robust it is:


   foreach (WorksheetPage wsPage in Project.WorksheetPages)
    {
		Tree tnFiles;

    	if (tree_get_binary_storage(tnFiles, wsPage, "Files"))
    	{
    		foreach(TreeNode trFile in tnFiles.Children)
			{
				string strFilePath = trFile.Info.FilePath.strVal;
			}
    	}
    }

1   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 12/02/2013 : 12:12:56 PM
Since the file path info is stored at the page level, this line:
foreach (WorksheetPage wsPage in Project.WorksheetPages)
is sufficient to get all Worksheets.

The line:
foreach(TreeNode trFile in tnFiles.Children)
will get all imported files regardless of which sheet the data was imported into and even when data was imported into new columns or new rows.

I added
printf("%s\n", strFilePath);
and strFilePath was correct for every situation I tested.

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