Skip to content

Commit 9f5ea3d

Browse files
committed
Update Example.
1 parent 8444d20 commit 9f5ea3d

File tree

5 files changed

+35
-34
lines changed

5 files changed

+35
-34
lines changed

examples/Aspose.Cells.Cloud.SDK.Examples.csproj

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<TargetFrameworks>Net6</TargetFrameworks>
5-
<IsTestProject>true</IsTestProject>
5+
<OutputType>Exe</OutputType>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
68
</PropertyGroup>
79
<ItemGroup>
8-
<Compile Remove="TestResults\**" />
9-
<EmbeddedResource Remove="TestResults\**" />
10-
<None Remove="TestResults\**" />
11-
</ItemGroup>
12-
<ItemGroup>
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
14-
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
15-
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
1610
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1711
</ItemGroup>
1812
<ItemGroup>

examples/Example_ChartToImage.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
namespace Aspose.Cells.Cloud.SDK.Tests.Api.Example
22
{
3-
using Microsoft.VisualStudio.TestTools.UnitTesting;
43
using Aspose.Cells.Cloud.SDK.Request;
5-
using System.Collections.Generic;
64
using Aspose.Cells.Cloud.SDK.Api;
7-
using System;
8-
using System.IO;
95

106
public class CellsApiExample
117
{

examples/Example_TrimContent.cs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,29 @@ public static class Example_TrimContent
22
{
33
public static void Run()
44
{
5+
// Get your Client ID and Client Secret from https://dashboard.aspose.cloud (free registration is required).
56
var cellsApi = new Aspose.Cells.Cloud.SDK.Api.CellsApi(System.Environment.GetEnvironmentVariable("ProductClientId"), System.Environment.GetEnvironmentVariable("ProductClientSecret"));
7+
// Build trim content request parameters
68
var request = new Aspose.Cells.Cloud.SDK.Request.PostTrimContentRequest
79
{
810
trimContentOptions = new Aspose.Cells.Cloud.SDK.Model.TrimContentOptions
911
{
1012
DataSource = new Aspose.Cells.Cloud.SDK.Model.DataSource { DataSourceType = "RequestFiles" },
11-
FileInfo = new Aspose.Cells.Cloud.SDK.Model.FileInfo
12-
{
13-
Filename = "BookText.xlsx",
14-
FileContent = System.Convert.ToBase64String(System.IO.File.ReadAllBytes("BookText.xlsx"))
15-
},
13+
// Set the source file information. Convert file data to base64 encoded string.
14+
FileInfo = new Aspose.Cells.Cloud.SDK.Model.FileInfo { Filename = "BookText.xlsx", FileContent = System.Convert.ToBase64String(System.IO.File.ReadAllBytes("BookText.xlsx")) },
1615
RemoveAllLineBreaks = true,
1716
RemoveExtraLineBreaks = true,
1817
TrimSpaceBetweenWordTo1 = true,
1918
ScopeOptions = new Aspose.Cells.Cloud.SDK.Model.ScopeOptions
2019
{
2120
Scope = "SelectionOlny",
22-
ScopeItems = new System.Collections.Generic.List<Aspose.Cells.Cloud.SDK.Model.ScopeItem> {
23-
new Aspose.Cells.Cloud.SDK.Model.ScopeItem {
24-
WorksheetName = "Sales",
25-
Ranges = new System.Collections.Generic.List<string> { "B1:B3"}
26-
} }
27-
}
21+
ScopeItems = new System.Collections.Generic.List<Aspose.Cells.Cloud.SDK.Model.ScopeItem> { new Aspose.Cells.Cloud.SDK.Model.ScopeItem { Worksheet = "Sales", Ranges = new System.Collections.Generic.List<string> { "B1:B3"} } }
22+
}
2823
}
2924
};
30-
var response = cellsApi.PostTrimContent(request);
25+
// Post trim content Web API request.
26+
var response = cellsApi.PostTrimContent(request);
27+
// Save result: convert base64 string to file.
3128
System.IO.File.WriteAllBytes("BookText_TrimContent.xlsx", System.Convert.FromBase64String(response.FileContent));
3229
}
3330
}

examples/Example_WordCase.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ public static class Example_WordCase
22
{
33
public static void Run()
44
{
5+
// Get your Client ID and Client Secret from https://dashboard.aspose.cloud (free registration is required).
56
var cellsApi = new Aspose.Cells.Cloud.SDK.Api.CellsApi(System.Environment.GetEnvironmentVariable("ProductClientId"), System.Environment.GetEnvironmentVariable("ProductClientSecret"));
6-
var request = new Aspose.Cells.Cloud.SDK.Request.PostUpdateWordCaseRequest
7-
{
8-
wordCaseOptions = new Aspose.Cells.Cloud.SDK.Model.WordCaseOptions
7+
// Build word case request parameters
8+
var request = new Aspose.Cells.Cloud.SDK.Request.PostUpdateWordCaseRequest
9+
{
10+
wordCaseOptions = new Aspose.Cells.Cloud.SDK.Model.WordCaseOptions
911
{
1012
DataSource = new Aspose.Cells.Cloud.SDK.Model.DataSource { DataSourceType = "RequestFiles" },
13+
// Set the source file information. Convert file data to base64 encoded string.
1114
FileInfo = new Aspose.Cells.Cloud.SDK.Model.FileInfo
1215
{
1316
Filename = "BookText.xlsx",
@@ -17,15 +20,15 @@ public static void Run()
1720
ScopeOptions = new Aspose.Cells.Cloud.SDK.Model.ScopeOptions
1821
{
1922
Scope = "SelectionOlny",
20-
ScopeItems = new System.Collections.Generic.List<Aspose.Cells.Cloud.SDK.Model.ScopeItem> {
21-
new Aspose.Cells.Cloud.SDK.Model.ScopeItem {
22-
WorksheetName = "Sales",
23-
Ranges = new System.Collections.Generic.List<string> { "B1:B3"}
24-
} }
25-
}
23+
ScopeItems = new System.Collections.Generic.List<Aspose.Cells.Cloud.SDK.Model.ScopeItem> {
24+
new Aspose.Cells.Cloud.SDK.Model.ScopeItem { Worksheet = "Sales", Ranges = new System.Collections.Generic.List<string> { "B1:B3"}
25+
}}
26+
}
2627
}
2728
};
29+
// Post trim content Web API request.
2830
var response = cellsApi.PostUpdateWordCase(request);
31+
// Save result: convert base64 string to file.
2932
System.IO.File.WriteAllBytes("BookText_WordCase.xlsx", System.Convert.FromBase64String(response.FileContent));
3033
}
3134
}

examples/Program.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace Aspose.Cells.Cloud.SDK.Examples
2+
{
3+
public class Program
4+
{
5+
static void Main(string[] args)
6+
{
7+
//Example_WordCase.Run();
8+
//Example_TrimContent.Run();
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)