Şablon dosyasıyla Excel çalışma kitabı nasıl oluşturulur Bu REST API, template file
‘den workbook
oluşturulacağını belirtir.
Sorgu Parametresi
Parametre adı
Tip
Tanım
şablonDosyası
sicim
veri dosyası
sicim
isWriteOver
sicim
doğru yanlış
dosya
sicim
Orijinal çalışma kitabı klasörü.
depolamaAdı
sicim
Depolama adı.
Gövde Parametresini Talep Et
Parametre adı
Tip
Tanım
veri
dosya
DİNLENME API
API
Tip
Tanım
Swagger Bağlantısı
/hücreler/{isim}
KOYMAK
Şablon dosyasından yeni bir Excel Çalışma Kitabı oluşturun
PutWorkbookCreate
OpenAPI Spesifikasyonu herkese açık bir programlama arayüzü tanımlar ve REST etkileşimlerini doğrudan bir web tarayıcısından gerçekleştirmenize olanak tanır.
KullanabilirsinizcURL Aspose.Cells web hizmetlerine kolayca erişmek için komut satırı aracı. Aşağıdaki örnekte, cURL ile Cloud API’e nasıl çağrı yapılacağı gösterilmektedir.
Request
Copy
curl - X PUT "https://api.aspose.cloud/v3.0/cells/newworkbook.xlsx?templateFile=Calendar.xlsx&dataFile=Sample_Data.xml&isWriteOver=true" - H "accept: application/json" - H "x-aspose-client: Containerize.Swagger"
Response
Copy
{
"Status" : "string" ,
"Workbook" : {
"FileName" : "string" ,
"Links" : [
{
"Href" : "string" ,
"Rel" : "string" ,
"Title" : "string" ,
"Type" : "string"
}
],
"Worksheets" : {
"link" : {
"Href" : "string" ,
"Rel" : "string" ,
"Title" : "string" ,
"Type" : "string"
}
},
"DefaultStyle" : {
"link" : {
"Href" : "string" ,
"Rel" : "string" ,
"Title" : "string" ,
"Type" : "string"
}
},
"DocumentProperties" : {
"link" : {
"Href" : "string" ,
"Rel" : "string" ,
"Title" : "string" ,
"Type" : "string"
}
},
"Names" : {
"link" : {
"Href" : "string" ,
"Rel" : "string" ,
"Title" : "string" ,
"Type" : "string"
}
},
"Settings" : {
"link" : {
"Href" : "string" ,
"Rel" : "string" ,
"Title" : "string" ,
"Type" : "string"
}
},
"IsWriteProtected" : "string" ,
"IsProtected" : "string" ,
"IsEncryption" : "string" ,
"Password" : "string"
}
}
Bulut SDK Ailesi
SDK kullanmak, geliştirmeyi hızlandırmanın en iyi yoludur. Bir SDK, düşük düzeyli ayrıntılarla ilgilenir ve proje görevlerinize odaklanmanıza olanak tanır. Lütfen şuraya göz atın:GitHub deposu Aspose.Cells Bulut SDK’larının tam listesi için.
Aşağıdaki kod örnekleri, çeşitli SDK’ları kullanarak Aspose.Cells web hizmetlerine nasıl çağrı yapılacağını gösterir:
C#
Java
PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php
# For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-php
require_once('vendor\autoload.php');
use \Aspose\Cells\Cloud\Api\CellsApi;
use \Aspose\Cells\Cloud\Request\PutWorkbookCreateRequest;
class Workbook {
public $instance;
public function __construct() {
$this->instance = new CellsApi(getenv("CellsCloudClientId"),getenv("CellsCloudClientSecret"),"v3.0",getenv("CellsCloudApiBaseUrl"));
}
public function putWorkbookCreate() {
$remoteFolder = "TestData/In";
$localName = "Book1.xlsx";
$reportDataXML = "ReportData.xml";
$remoteName = "Book1.xlsx";
$request = new PutWorkbookCreateRequest();
$request->setName( "PutWorkbookCreate.xlsx");
$request->setTemplateFile( $remoteFolder . "/" . $remoteName);
$request->setDataFile( $remoteFolder . "/ReportData.xml");
$request->setIsWriteOver( 'true');
$request->setFolder( $remoteFolder);
$request->setStorageName( "");
$request->setCheckExcelRestriction( 'true');
$this->instance->putWorkbookCreate($request);
}
}
$workbook = new Workbook();
$workbook->putWorkbookCreate();
?>
Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-ruby
require 'aspose_cells_cloud'
class Workbook
include AsposeCellsCloud
def initialize
#Get client_id and client_secret from https://cloud.aspose.com
@instance = AsposeCellsCloud::CellsApi.new($client_id,$client_secret,$api_version,$baseurl)
end
# Create new workbook using different methods.
def create_new_workbook
t = Time.now
name = Time.now.strftime("%y%m%d%H%M%s") + $BOOK1
template_file = $BOOK1
data_file = 'ReportData.xml'
folder = $TEMPFOLDER
result = @instance.upload_file( folder+"/"+template_file, ::File.open(File.expand_path("data/"+template_file),"r") {|io| io.read(io.size) })
expect(result.uploaded.size).to be > 0
result = @instance.upload_file(folder+"/"+data_file, ::File.open(File.expand_path("data/"+data_file),"r") {|io| io.read(io.size) })
expect(result.uploaded.size).to be > 0
result = @instance.cells_workbook_put_workbook_create(name, {:template_file=>folder+"/"+template_file, :data_file=>folder+"/"+data_file, :folder=>folder})
end
end
workbook = Workbook.new()
puts workbook.put_workbook_create
Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-python
import os
from asposecellscloud.apis.cells_api import CellsApi
from asposecellscloud.models import *
from asposecellscloud.requests import *
api = CellsApi(os.getenv('CellsCloudClientId'),os.getenv('CellsCloudClientSecret'),"v3.0",os.getenv('CellsCloudApiBaseUrl'))
request = PutWorkbookCreateRequest( 'PutWorkbookCreate.xlsx',template_file= 'PythonTest/Book1.xlsx',is_write_over= True,folder= 'PythonTest',storage_name= '',check_excel_restriction= True)
api.put_workbook_create(request)
Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { CellsApi, UploadFileRequest, CellsWorkbook_PutWorkbookCreateRequest } = require("asposecellscloud");
const clientId = process.env.CellsCloudClientId;
const clientSecret = process.env.CellsCloudClientSecret;
const ApiURL = process.env.CellsCloudApiBaseUrl;
const fs = require('fs');
const path = require('path');
const cellsApi = new CellsApi(clientId, clientSecret,"v3.0",ApiURL);
const localPath = "D:/aspose-cells-cloud-node/TestData/"
const filename = "Book1.xlsx";
const data =fs.createReadStream(path.join(localPath, filename));
const req = new UploadFileRequest({
path: "Temp/" + filename,
file: data
});
cellsApi.uploadFile(req)
.then((result) => {
const req = new CellsWorkbook_PutWorkbookCreateRequest();
req.folder = "Temp";
const date = new Date();
const year = date.getUTCFullYear();
const month = date.getUTCMonth();
const day = date.getUTCDate();
const hours = date.getUTCHours();
const min = date.getUTCMinutes();
const sec = date.getUTCSeconds();
req.name ="NewBook" + year + "" + month + "" + day + "" + ".xlsx";
req.templateFile = "Temp/Book1.xlsx";
req.dataFile = "ReportData.xml";
req.isWriteOver = true;
cellsApi.cellsWorkbookPutWorkbookCreate(req)
.then((result) => {
console.log("successful")
}).catch((error) => {
console.error('Unhandled Promise Rejection:', error);
})
})
Android
Swift
Perl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-perl/
use strict;
use warnings;
use utf8;
use File::Slurp;
use MIME::Base64;
use AsposeCellsCloud::CellsApi;
my $config = AsposeCellsCloud::Configuration->new( client_id => $ENV{'ProductClientId'}, client_secret => $ENV{'ProductClientSecret'});
my $instance = AsposeCellsCloud::CellsApi->new(AsposeCellsCloud::ApiClient->new( $config));
my $result =undef;
my $BOOK1 = 'Book1.xlsx';
my $MYDOC = 'myDocument.xlsx';
my $PVTESTFILE = 'TestCase.xlsx';
my $TEMPFOLDER = 'PerlTest';
my $SHEET1 = 'Sheet1';
my $SHEET2 = 'Sheet2';
my $SHEET3 = 'Sheet3';
my $SHEET4 = 'Sheet4';
my $SHEET5 = 'Sheet5';
my $SHEET6 = 'Sheet6';
my $SHEET7 = 'Sheet7';
my $SHEET8 = 'Sheet8';
my $CELLNAME = 'A1';
my $RANGE = 'A1:C10';
my $CELLAREA = 'A1:C10';
my $api = get_client();
my $name = 'NewBook'.$BOOK1; # replace NULL with a proper value
my $template_file = $BOOK1; # replace NULL with a proper value
my $data_file = NULL; # replace NULL with a proper value
my $folder = $TEMPFOLDER; # replace NULL with a proper value
ready_file('api'=> $api, 'file'=>$template_file ,'folder' =>$folder) ;
ready_file('api'=> $api, 'file'=>$data_file ,'folder' =>$folder);
$result = $api->cells_workbook_put_workbook_create(name => $name, template_file =>$folder."/".$template_file, data_file => $folder."/".$data_file, folder => $folder,is_write_over => 'true');
Go
Swift