Skip to content

Commit eda55f5

Browse files
committed
Release Aspose.Cells Cloud SDK 24.2.1
1 parent 529436e commit eda55f5

File tree

384 files changed

+1665
-23608
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

384 files changed

+1665
-23608
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Aspose.Cells.Cloud.SDK.Api;
2+
using Aspose.Cells.Cloud.SDK.Model;
3+
using Aspose.Cells.Cloud.SDK.Request;
4+
using System;
5+
using System.IO;
6+
using System.Collections.Generic;
7+
8+
CellsApi cellsApi = new CellsApi("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
9+
string remoteFolder = "TestData/In";
10+
11+
string localName = "Book1.xlsx";
12+
string remoteName = "Book1.xlsx";
13+
14+
this.UploadFile( localName, remoteFolder + "/" + remoteName, "");
15+
16+
var request = new PostFitTallToPagesRequest(
17+
name: remoteName,
18+
sheetName: "Sheet1",
19+
folder: remoteFolder,
20+
storageName: ""
21+
);
22+
this.CellsApi.PostFitTallToPages(request);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Aspose.Cells.Cloud.SDK.Api;
2+
using Aspose.Cells.Cloud.SDK.Model;
3+
using Aspose.Cells.Cloud.SDK.Request;
4+
using System;
5+
using System.IO;
6+
using System.Collections.Generic;
7+
8+
CellsApi cellsApi = new CellsApi("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
9+
string remoteFolder = "TestData/In";
10+
11+
string localName = "Book1.xlsx";
12+
string remoteName = "Book1.xlsx";
13+
14+
this.UploadFile( localName, remoteFolder + "/" + remoteName, "");
15+
16+
var request = new PostFitWideToPagesRequest(
17+
name: remoteName,
18+
sheetName: "Sheet1",
19+
folder: remoteFolder,
20+
storageName: ""
21+
);
22+
this.CellsApi.PostFitWideToPages(request);

Aspose.Cells.Cloud.SDK.Test/Api/CellsStatusControllerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void TestGetCellsCloudServicesHealthCheck()
5252
var request = new GetCellsCloudServicesHealthCheckRequest(
5353
);
5454
var actual = this.CellsApi.GetCellsCloudServicesHealthCheck(request);
55-
Assert.AreEqual("{\"Status\":\"Cells Cloud(v24.1.1) is working fine!\"}", actual);
55+
Assert.AreEqual("{\"Status\":\"Cells Cloud(v24.2.1) is working fine!\"}", actual);
5656
}
5757

5858
/// <summary>

Aspose.Cells.Cloud.SDK.Test/Api/PageSetupControllerTests.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,5 +203,49 @@ public void TestPostFooter()
203203
var actual = this.CellsApi.PostFooter(request);
204204
Assert.AreEqual(200, actual.Code);
205205
}
206+
207+
/// <summary>
208+
/// Test for PostFitWideToPages of PageSetupController.
209+
/// </summary>
210+
[TestCategory(ProductName)]
211+
[TestMethod]
212+
public void TestPostFitWideToPages()
213+
{
214+
string localName = "Book1.xlsx";
215+
string remoteName = "Book1.xlsx";
216+
217+
this.UploadFile( localName, remoteFolder + "/" + remoteName, "");
218+
219+
var request = new PostFitWideToPagesRequest(
220+
name: remoteName,
221+
sheetName: "Sheet1",
222+
folder: remoteFolder,
223+
storageName: ""
224+
);
225+
var actual = this.CellsApi.PostFitWideToPages(request);
226+
Assert.AreEqual(200, actual.Code);
227+
}
228+
229+
/// <summary>
230+
/// Test for PostFitTallToPages of PageSetupController.
231+
/// </summary>
232+
[TestCategory(ProductName)]
233+
[TestMethod]
234+
public void TestPostFitTallToPages()
235+
{
236+
string localName = "Book1.xlsx";
237+
string remoteName = "Book1.xlsx";
238+
239+
this.UploadFile( localName, remoteFolder + "/" + remoteName, "");
240+
241+
var request = new PostFitTallToPagesRequest(
242+
name: remoteName,
243+
sheetName: "Sheet1",
244+
folder: remoteFolder,
245+
storageName: ""
246+
);
247+
var actual = this.CellsApi.PostFitTallToPages(request);
248+
Assert.AreEqual(200, actual.Code);
249+
}
206250
}
207251
}

Aspose.Cells.Cloud.SDK/Api/CellsApi.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,19 @@ public CellsApi(string clientId, string clientSecrent,string baseUrl = "https://
6565
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
6666
}
6767

68+
/// <summary>
69+
/// Perform business analysis of data in Excel files.
70+
/// </summary>
71+
/// <param name="request">Request. <see cref="PostAnalyzeExcelRequest" /></param>
72+
public IList<AnalyzedResult> PostAnalyzeExcel(PostAnalyzeExcelRequest request)
73+
{
74+
requestHandlers.ForEach(p => p.ProcessUrl(""));
75+
var result = invoker.InvokeApiAsync< IList<AnalyzedResult> >(request.CreateHttpRequest(BaseUri +"/" +Version, this.invoker.DefaultHeaderMap, this.requestHandlers)).Result;
76+
return result;
77+
}
78+
79+
80+
6881
/// <summary>
6982
/// Retrieve the description of auto filters from a worksheet.
7083
/// </summary>
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
// --------------------------------------------------------------------------------------------------------------------
2+
// <copyright company="Aspose" file="CellsApiExtension.cs.cs">
3+
// Copyright (c) 2024 Aspose.Cells Cloud
4+
// </copyright>
5+
// <summary>
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in all
14+
// copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
// SOFTWARE.
23+
// </summary>
24+
// --------------------------------------------------------------------------------------------------------------------
25+
26+
namespace Aspose.Cells.Cloud.SDK.Api
27+
{
28+
using Aspose.Cells.Cloud.SDK.Extensions;
29+
using System;
30+
using System.Collections.Generic;
31+
using System.IO;
32+
///<summary>
33+
///
34+
///</summary>
35+
public static class CellsApiExtension
36+
{
37+
///<summary>
38+
///
39+
///</summary>
40+
///<param name="conversionRequest"></param>
41+
public static void Convert(this CellsApi cellsApi, Request.ConversionRequest conversionRequest)
42+
{
43+
var password = string.Empty;
44+
var outPath = string.Empty;
45+
var storageName = string.Empty;
46+
if (!File.Exists(conversionRequest.InputPath))
47+
{
48+
throw new ApplicationException("Input file no exists.");
49+
}
50+
if (string.IsNullOrEmpty(conversionRequest.OutputPath))
51+
{
52+
throw new ApplicationException("OutputPath is Empty.");
53+
}
54+
Request.PutConvertWorkbookRequest putConvertWorkbookRequest = new Request.PutConvertWorkbookRequest();
55+
putConvertWorkbookRequest.File = new Dictionary<string, Stream>();
56+
putConvertWorkbookRequest.File.Add( (new System.IO.FileInfo(conversionRequest.InputPath)).Name, File.OpenRead(conversionRequest.InputPath) );
57+
putConvertWorkbookRequest.format = conversionRequest.OutputPath.GetFileFormat();
58+
putConvertWorkbookRequest.password = conversionRequest.password;
59+
putConvertWorkbookRequest.outPath = conversionRequest.OutputPath;
60+
putConvertWorkbookRequest.storageName = conversionRequest.StorageName;
61+
putConvertWorkbookRequest.streamFormat = conversionRequest.InputPath.GetFileFormat();
62+
63+
using (Stream responseStream = cellsApi.PutConvertWorkbook(putConvertWorkbookRequest))
64+
{
65+
if (conversionRequest.SaveToCloud.HasValue && conversionRequest.SaveToCloud.Value)
66+
{
67+
responseStream.Close();
68+
}
69+
else
70+
{
71+
Stream outStream = File.Create(conversionRequest.OutputPath);
72+
responseStream.CopyTo(outStream);
73+
outStream.Flush();
74+
outStream.Close();
75+
}
76+
}
77+
}
78+
79+
///<summary>
80+
///
81+
///</summary>
82+
///<param name="mergeRequest"></param>
83+
public static void Merge(this CellsApi cellsApi, Request.MergeRequest mergeRequest)
84+
{
85+
if (mergeRequest.InputFiles == null || mergeRequest.InputFiles.Length ==0)
86+
{
87+
throw new ApplicationException("Input file no exists.");
88+
}
89+
foreach( string filename in mergeRequest.InputFiles)
90+
{
91+
if (!File.Exists(filename))
92+
{
93+
throw new ApplicationException("Input file no exists.");
94+
}
95+
}
96+
97+
if (string.IsNullOrEmpty(mergeRequest.OutputPath))
98+
{
99+
throw new ApplicationException("OutputPath is Empty.");
100+
}
101+
102+
Request.PostMergeRequest request = new Request.PostMergeRequest();
103+
request.File = new Dictionary<string, Stream>();
104+
foreach (string filename in mergeRequest.InputFiles)
105+
{
106+
request.File.Add((new System.IO.FileInfo(filename)).Name, File.OpenRead(filename));
107+
}
108+
109+
request.outFormat = mergeRequest.OutputPath.GetFileFormat();
110+
request.mergeToOneSheet = mergeRequest.mergeToOneSheet;
111+
112+
Model.FileInfo fileInfo = cellsApi.PostMerge(request);
113+
Stream resultStream = fileInfo.FileContent.Base64StringToStream();
114+
if (mergeRequest.SaveToCloud.HasValue && mergeRequest.SaveToCloud.Value)
115+
{
116+
Request.UploadFileRequest uploadFileRequest = new Request.UploadFileRequest();
117+
uploadFileRequest.path = mergeRequest.OutputPath;
118+
uploadFileRequest.storageName = mergeRequest.StorageName;
119+
uploadFileRequest.UploadFiles = new Dictionary<string, Stream> { { (new System.IO.FileInfo(fileInfo.Filename)).Name, resultStream } };
120+
cellsApi.UploadFile(uploadFileRequest);
121+
}
122+
else
123+
{
124+
Stream outStream = File.Create(mergeRequest.OutputPath);
125+
resultStream.CopyTo(outStream);
126+
outStream.Flush();
127+
outStream.Close();
128+
resultStream.Close();
129+
}
130+
}
131+
public static void Unlock(this CellsApi cellsApi, Request.UnlockRequest unlockRequest)
132+
{
133+
if (unlockRequest.InputPath == null )
134+
{
135+
throw new ApplicationException("Input file no exists.");
136+
}
137+
if (!File.Exists(unlockRequest.InputPath))
138+
{
139+
throw new ApplicationException("Input file no exists.");
140+
}
141+
if (string.IsNullOrEmpty(unlockRequest.OutputPath))
142+
{
143+
throw new ApplicationException("OutputPath is Empty.");
144+
}
145+
Request.PostUnlockRequest request = new Request.PostUnlockRequest();
146+
request.File = new Dictionary<string, Stream>();
147+
request.File.Add((new System.IO.FileInfo(unlockRequest.InputPath)).Name, File.OpenRead(unlockRequest.InputPath));
148+
149+
request.password = unlockRequest.Password;
150+
151+
Model.FilesResult filesResult = cellsApi.PostUnlock(request);
152+
foreach( Model.FileInfo fileInfo in filesResult.Files)
153+
{
154+
Stream resultStream = fileInfo.FileContent.Base64StringToStream();
155+
if (unlockRequest.SaveToCloud.HasValue && unlockRequest.SaveToCloud.Value)
156+
{
157+
Request.UploadFileRequest uploadFileRequest = new Request.UploadFileRequest();
158+
uploadFileRequest.path = unlockRequest.OutputPath;
159+
uploadFileRequest.storageName = unlockRequest.StorageName;
160+
uploadFileRequest.UploadFiles = new Dictionary<string, Stream> { { (new System.IO.FileInfo(fileInfo.Filename)).Name, resultStream } };
161+
cellsApi.UploadFile(uploadFileRequest);
162+
}
163+
else
164+
{
165+
Stream outStream = File.Create(unlockRequest.OutputPath);
166+
resultStream.CopyTo(outStream);
167+
outStream.Flush();
168+
outStream.Close();
169+
resultStream.Close();
170+
}
171+
}
172+
173+
}
174+
public static void Protect(this CellsApi cellsApi , Request.ProtectRequest protectRequest)
175+
{
176+
if (protectRequest.InputPath == null)
177+
{
178+
throw new ApplicationException("Input file no exists.");
179+
}
180+
if (!File.Exists(protectRequest.InputPath))
181+
{
182+
throw new ApplicationException("Input file no exists.");
183+
}
184+
if (string.IsNullOrEmpty(protectRequest.OutputPath))
185+
{
186+
throw new ApplicationException("OutputPath is Empty.");
187+
}
188+
189+
Request.PostProtectRequest request = new Request.PostProtectRequest();
190+
request.File = new Dictionary<string, Stream>();
191+
request.File.Add((new System.IO.FileInfo(protectRequest.InputPath)).Name, File.OpenRead(protectRequest.InputPath));
192+
193+
request.password = protectRequest.Password;
194+
195+
Model.FilesResult filesResult = cellsApi.PostProtect(request);
196+
foreach (Model.FileInfo fileInfo in filesResult.Files)
197+
{
198+
Stream resultStream = fileInfo.FileContent.Base64StringToStream();
199+
if (protectRequest.SaveToCloud.HasValue && protectRequest.SaveToCloud.Value)
200+
{
201+
Request.UploadFileRequest uploadFileRequest = new Request.UploadFileRequest();
202+
uploadFileRequest.path = protectRequest.OutputPath;
203+
uploadFileRequest.storageName = protectRequest.StorageName;
204+
uploadFileRequest.UploadFiles = new Dictionary<string, Stream> { { (new System.IO.FileInfo(fileInfo.Filename)).Name, resultStream } };
205+
cellsApi.UploadFile(uploadFileRequest);
206+
}
207+
else
208+
{
209+
Stream outStream = File.Create(protectRequest.OutputPath);
210+
resultStream.CopyTo(outStream);
211+
outStream.Flush();
212+
outStream.Close();
213+
resultStream.Close();
214+
}
215+
}
216+
}
217+
}
218+
}

Aspose.Cells.Cloud.SDK/Aspose.Cells.Cloud.SDK.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<RepositoryType>GitHub</RepositoryType>
1818
<Copyright>MIT</Copyright>
1919
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
20-
<AssemblyVersion>24.1.1</AssemblyVersion>
21-
<FileVersion>24.1.1</FileVersion>
22-
<Version>24.1.1</Version>
20+
<AssemblyVersion>24.2.1</AssemblyVersion>
21+
<FileVersion>24.2.1</FileVersion>
22+
<Version>24.2.1</Version>
2323
<PackageReadmeFile>README.md</PackageReadmeFile>
2424

2525
</PropertyGroup>

Aspose.Cells.Cloud.SDK/Infrastructure/Invoker/ApiInvoker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ internal class ApiInvoker
5050
internal ApiInvoker(List<IRequestHandler> requestHandlers)
5151
{
5252
this.AddDefaultHeader(AsposeClientHeaderName, ".net sdk");
53-
this.AddDefaultHeader(AsposeClientVersionHeaderName, "24.1.1");
53+
this.AddDefaultHeader(AsposeClientVersionHeaderName, "24.2.1");
5454
this.requestHandlers = requestHandlers;
5555
}
5656

0 commit comments

Comments
 (0)