Search code examples
swiftxlsx

XlsxReaderWriter can save my BRAOfficeDocumentPackage using Swift


Hi there friends im trying to edit exelfiles in Swift. I can load a exelfile local from the bundle and save it. But when im downloading the same exel file I can edit it I cant save it. The error message I get is:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[BRARelationship contentType] is not implemented in BRARelationship'

   do{
     exelIntraUrl = try FileManager.default.url(for: 
     .documentDirectory, in: .userDomainMask, appropriateFor: nil, 
     create: false).appendingPathComponent("myExelFile.xlsx")
     self.exelIntra = BRAOfficeDocumentPackage.open(exelIntraUrl.path)

     }catch{
        print("some crazy error"        
     }

      self.exelIntra?.save()

Im also up for sugestion using some other libary


Solution

  • have you tried:

    let paths: Array = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true) as Array
    let fullPath: String = paths[0] + "MyFile.xlsx"
    print("saving at: \(fullPath)")
    worksheet.save()
    odp!.save(as: fullPath)
    

    Basically, is what the say on their page: XlsxReaderWriter