Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Domain=NSCocoaErrorDomain Code=260 #106

Open
EvGeniyLell opened this issue Dec 10, 2019 · 0 comments
Open

Error Domain=NSCocoaErrorDomain Code=260 #106

EvGeniyLell opened this issue Dec 10, 2019 · 0 comments

Comments

@EvGeniyLell
Copy link

I'm always having trouble with open xls on mac

Error Domain=NSCocoaErrorDomain Code=260 "The file “[Content_Types].xml” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/evgeniyilyin/Library/Containers/EvG.PBTool/Data/Library/Caches/fr.brae.spreadsheetdocument/111.xls/[Content_Types].xml, NSUnderlyingError=0x600000cc5e30 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
2019-12-11 01:09:15.093513+0200 PBTool[49912:9928113] Error while loading content of file .rels.

Error Domain=NSCocoaErrorDomain Code=260 "The file “.rels” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/evgeniyilyin/Library/Containers/EvG.PBTool/Data/Library/Caches/fr.brae.spreadsheetdocument/111.xls/_rels/.rels, NSUnderlyingError=0x600000cda0a0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value: file /Users/evgeniyilyin/Work/EvG/PBTool/PBTool/FileConverter.swift, line 83
2019-12-11 01:09:16.330339+0200 PBTool[49912:9928113] Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value: file /Users/evgeniyilyin/Work/EvG/PBTool/PBTool/FileConverter.swift, line 83

I try open original file and I try export it original file from Microsoft Exel again to xls and new xlsx but i cannot open any way

   @IBAction func testAction(_ sender: Any?) {
        
        selectFile() { (selectedFileUrl) in
            print(selectedFileUrl?.path)
            if let url = selectedFileUrl {
                let a = url.startAccessingSecurityScopedResource()
                let r = FileConverter.test(url.absoluteString)
                print(r)
            }
        }
    }
    
    func selectFile(complete: ((URL?)->Void)?) {
        let dialog = NSOpenPanel();
        
        dialog.title                   = "Choose a .xls file";
        dialog.showsResizeIndicator    = true;
        dialog.showsHiddenFiles        = false;
        dialog.canChooseDirectories    = true;
        dialog.canCreateDirectories    = true;
        dialog.allowsMultipleSelection = false;
        dialog.allowedFileTypes        = ["xls","xlsx"];
        
        let result = dialog.runModal()
        switch result {
        case .OK: // Pathname of the file
            complete?(dialog.url)
        default:
            complete?(nil)
        }
    }

where FileConverter.test it is

        guard
            let odp = BRAOfficeDocumentPackage.open(path),
            let ws = odp.workbook.worksheets.first as? BRAWorksheet // <<< - crash
            else { return nil }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant