سويفت API لتحويل XLSX إلى XLS

مكتبة سويفت لتحويل XLSX إلى XLS

استخدم Cells تحويل REST API لإنشاء سير عمل جدول بيانات مخصص في Swift. يعد هذا حلاً احترافيًا لتحويل XLSX إلى XLS وتنسيقات المستندات الأخرى عبر الإنترنت باستخدام Swift.

تحويل ملف XLSX إلى XLS في Swift

API
PUT
https://api.aspose.cloud/v3.0/cells/convert

يعد تحويل تنسيقات الملفات من XLSX إلى XLS مهمة معقدة. يتم تنفيذ جميع عمليات النقل من تنسيق XLSX إلى XLS بواسطة Swift SDK الخاص بنا مع الحفاظ على المحتوى الهيكلي والمنطقي الرئيسي لجدول بيانات XLSX المصدر. تعد مكتبة Swift الخاصة بنا حلاً احترافيًا لتحويل ملفات XLSX إلى XLS عبر الإنترنت. يوفر Cloud SDK لمطوري Swift وظائف قوية ومخرجات XLS مثالية.

مثال على التعليمات البرمجية في Swift باستخدام REST API لتحويل تنسيق XLSX إلى تنسيق XLS

// For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-swift/
    import AsposeCellsCloud
    let expectation1 = self.expectation(description: "checkAuth")
    AsposeCellsCloudAPI.clientId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    AsposeCellsCloudAPI.clientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    AuthAspose.checkAuth()
    {
        (authError) in
        guard authError == nil else {
            XCTFail("error checkAuth")
            return
        }
        expectation1.fulfill()
    }
    self.waitForExpectations(timeout: testTimeout, handler: nil)        
    let expectation = self.expectation(description: "PutConvert")
    let workbook:String = "Book1.xlsx"
    let format:String? = "xls"     
    let url1: URL? = getURL(workbook)
    let filedata = NSData(contentsOfFile: url1!.path)
    let password:String? = nil
    let outPath:String? = nil
    CellsAPI.cellsWorkbookPutConvertWorkbook(file: url1!, format: format, password: password, outPath: outPath)
    {
        (response, error) in
        guard error == nil else {
            let errorinfo = self.GetErrorDataInfo(error: error as! ErrorResponse)
            print("error info: \(errorinfo!)")
            XCTFail("error PutConvert")
            return
        }            
        if let response = response {
            //response is a Data of file, we may write it down and check it.
            let fileName = "dest.xls"
            let filePath = NSHomeDirectory()
            let fileManager = FileManager.default
            let path = "\(filePath)/tmp/\(fileName)"
            fileManager.createFile(atPath: path, contents:nil, attributes:nil)
            let handle = FileHandle(forWritingAtPath:path)
            handle?.write(response as Data)
            expectation.fulfill()
        }
    }
    self.waitForExpectations(timeout: testTimeout, handler: nil)


كيفية استخدام Swift API لتحويل XLSX إلى XLS

  1. قم بإنشاء حساب علىلوحة القيادة للحصول على تفاصيل الحصص والترخيص API مجانًا
  2. تهيئة CellsApi باستخدام معرف العميل وسر العميل وعنوان URL الأساسي وإصدار API
  3. قم باستدعاء أسلوب cellWorkbookPutConvertWorkbook للحصول على الدفق الناتج


متطلبات النظام

  1. ماك مونتيري 12.4
  2. سويفت 4.2