On Aug 11, 08, at 2:28 PM, John Love wrote:

I have a multiple document Cocoa app where I (try to) open an external file in whatever application the file belongs to -- in my case, an Excel spreadsheet in Excel. The new Cocoa document window shown keeps track of the calculation progress in Excel via a NSProgressIndicator and a NSTextField.

So, instead of opening a text file and showing it directly in the NSWindow of MyDocument, I just want to startup Excel by selecting the appropriate file in Cocoa's open dialog. I have 'XLS8' in my "info.plist" file. The Excel spreadsheet opens up and the NSProgressIndicator starts spinning and the appropriate text is placed in the NSTextField.

I believe I want to do this opening within my override of - readFromURL. Am I on the right track here?

John Love


Found the answer -- I do need to override -readFromURL in the following manner:

- (BOOL) readFromURL:(NSURL*)absoluteURL ofType:(NSString*)typeName error:(NSError**)outError {
        NSWorkspace *workSpace;
        BOOL success;
        
        workSpace = [NSWorkspace sharedWorkspace];
        success = [workSpace openURL:absoluteURL];
        
        if (success) {
             // do stuff here
        }
        else {
             // other things here
        }
}

I still need to figure out if it is possible for Excel to communicate back to my app via some sort of NSNotification.

I don't have much hope of that .. so what I probably need to focus on is how to display the Excel spreadsheet in my document window.

Any ideas will definitely be very appreciated.

John Love

P.S. -- sorry about the initial double post


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to