Excel Çalışma Sayfasında Otomatik Uygunluk (Autofit) ile Çalışmak – Aspose.Cells Cloud API

Excel Çalışma Sayfasında Otomatik Uygunluk (Autofit) ile Çalışmak

Gereksinimler
Otomatik Uygunluk (Autofit) işlemlerini kullanmadan önce şunlara sahip olmanız gerekir:

  1. Geçerli bir Client Id ve Client Secret içeren bir Aspose.Cells Cloud hesabı.
  2. Aspose Cloud depo alanına yüklenmiş bir çalışma kitabına (veya herkese açık bir URL üzerinden erişilebilir bir çalışma kitabına).
  3. Değiştirmek istediğiniz çalışma sayfası adı.

API Referansı

İşlem HTTP Yöntemi Uç Nokta Gerekli Parametreler İstek Gövdesi Örnek Yanıt Durum Kodları
Bir sütunu otomatik uygun hale getir POST /cells/worksheets/{sheetName}/autofit/column sheetName (yol)
columnIndex (sorgu)
yok { "code": 200, "status": "OK", "message": "Sütun otomatik uygun hale getirildi." } 200, 400, 401, 404, 500
Sütunları otomatik uygun hale getir POST /cells/worksheets/{sheetName}/autofit/columns sheetName (yol)
startColumn, endColumn (sorgu)
yok { "code": 200, "status": "OK", "message": "Sütunlar otomatik uygun hale getirildi." } 200, 400, 401, 404, 500
Bir satırı otomatik uygun hale getir POST /cells/worksheets/{sheetName}/autofit/row sheetName (yol)
rowIndex (sorgu)
yok { "code": 200, "status": "OK", "message": "Satır otomatik uygun hale getirildi." } 200, 400, 401, 404, 500
Satırları otomatik uygun hale getir POST /cells/worksheets/{sheetName}/autofit/rows sheetName (yol)
startRow, endRow (sorgu)
yok { "code": 200, "status": "OK", "message": "Satırlar otomatik uygun hale getirildi." } 200, 400, 401, 404, 500

Kod Örnekleri

cURL

curl -X POST "https://api.aspose.cloud/v3.0/cells/worksheets/MySheet/autofit/columns?startColumn=0&endColumn=5" \
     -H "Authorization: Bearer {access_token}" \
     -H "Content-Type: application/json"

.NET (C#)

using Aspose.Cells.Cloud.SDK.Api;
using Aspose.Cells.Cloud.SDK.Model;

// Kimlik doğrulama
var apiInstance = new CellsApi("{client_id}", "{client_secret}");

// Sütunları otomatik uygun hale getirme çağrısı
var response = apiInstance.PostWorksheetAutofitColumns(
    name: "Workbook.xlsx",
    sheetName: "Sheet1",
    startColumn: 0,
    endColumn: 5,
    folder: "",
    storageName: ""
);
Console.WriteLine(response.Status);

Java

import com.aspose.cloud.cells.api.CellsApi;
import com.aspose.cloud.cells.model.*;

CellsApi api = new CellsApi("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET");

// Satırları otomatik uygun hale getir
PostWorksheetAutofitRowsResponse resp = api.postWorksheetAutofitRows(
    "Workbook.xlsx",
    "Sheet1",
    0,   // startRow
    10,  // endRow
    "",  // folder
    ""   // storageName
);
System.out.println(resp.getStatus());

Python

from asposecellscloud import CellsApi, ApiClient, Configuration

config = Configuration()
config.client_id = "YOUR_CLIENT_ID"
config.client_secret = "YOUR_CLIENT_SECRET"
api_client = ApiClient(configuration=config)
api = CellsApi(api_client)

# Tek bir sütunu otomatik uygun hale getir
response = api.post_worksheet_autofit_column(
    name="Workbook.xlsx",
    sheet_name="Sheet1",
    column_index=2,
    folder="",
    storage_name=""
)
print(response.status)

Bu kod parçacıkları şunları nasıl yapacağınızı gösterir:

  1. Client Id ve Client Secret bilgilerinizle Aspose.Cells Cloud’a kimlik doğrulama.
  2. Sütunlar veya satırlar için uygun Otomatik Uygunluk (Autofit) uç noktasını çağırma.
  3. İşlemin başarıyla tamamlandığını onaylayan yanıtı işleme.

Sonraki Adımlar

Otomatik Uygunluk (Autofit) çağrısı tamamlandıktan sonra güncellenmiş çalışma kitabını indirebilirsiniz:

curl -X GET "https://api.aspose.cloud/v3.0/cells/Workbook.xlsx" \
     -H "Authorization: Bearer {access_token}" \
     -o UpdatedWorkbook.xlsx

Belirli aralıkları hedeflemek için startColumn, endColumn, startRow ve endRow parametrelerini istediğiniz gibi ayarlamaktan çekinmeyin.