Экспорт JSON в файл DOCX в облаке

Excel и экспорт таблиц OpenOffice с помощью Cloud SDK с открытым исходным кодом для Swift.

Преобразование JSON в файл DOCX в Cloud SDK для Swift

  1. Создайте учетную запись наПанель приборов чтобы бесплатно получить информацию о квоте и авторизации по номеру API
  2. Инициализируйте CellsApi, используя идентификатор клиента, секрет клиента, базовый URL-адрес и версию API.
  3. Вызовите метод cellsWorkbookPutConvertWorkbook, чтобы получить результирующий поток DOCX.

Начните с Excel REST API

Получите исходный код Excel Cloud SDK for .NET с сайтаGitHub скомпилировать SDK самостоятельно или перейти кРелизы альтернативные варианты загрузки.

Также взгляните на Swagger на основеAPI Ссылка чтобы узнать больше оExcel ОТДЫХ API.

Swift-код для преобразования JSON в DOCX

    // 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? = "docx"     
    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.docx"
            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)

FAQ

  • How can I get started with Aspose. REST APIs?
    Quickstart not only guides through the initialization of Aspose. Cloud API, it also helps in installing the required libraries.
  • Where can I see the release notes for Aspose. Cloud API?
    Complete release notes can be reviewed at Aspose. Cloud Documentation.
  • Is it safe to convert to in the Cloud?
    Of course! Aspose Cloud uses Amazon EC2 cloud servers that guarantee the security and resilience of the service. Please read more about Aspose's Security Practices.
  • What file formats are supported by Aspose. Cloud API?
    Aspose. Cloud can convert to and more. Checkout the complete list of supported file formats.
  • I do not have time to set up. Is there a quick demo for to that I can try?
    Indeed! Checkout the to Conversion App.

Other Options

What is File Format?

What is File Format?