@@ -2,32 +2,29 @@ public static class Example_TrimContent
2
2
{
3
3
public static void Run ( )
4
4
{
5
+ // Get your Client ID and Client Secret from https://dashboard.aspose.cloud (free registration is required).
5
6
var cellsApi = new Aspose . Cells . Cloud . SDK . Api . CellsApi ( System . Environment . GetEnvironmentVariable ( "ProductClientId" ) , System . Environment . GetEnvironmentVariable ( "ProductClientSecret" ) ) ;
7
+ // Build trim content request parameters
6
8
var request = new Aspose . Cells . Cloud . SDK . Request . PostTrimContentRequest
7
9
{
8
10
trimContentOptions = new Aspose . Cells . Cloud . SDK . Model . TrimContentOptions
9
11
{
10
12
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" ) ) } ,
16
15
RemoveAllLineBreaks = true ,
17
16
RemoveExtraLineBreaks = true ,
18
17
TrimSpaceBetweenWordTo1 = true ,
19
18
ScopeOptions = new Aspose . Cells . Cloud . SDK . Model . ScopeOptions
20
19
{
21
20
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
+ }
28
23
}
29
24
} ;
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.
31
28
System . IO . File . WriteAllBytes ( "BookText_TrimContent.xlsx" , System . Convert . FromBase64String ( response . FileContent ) ) ;
32
29
}
33
30
}
0 commit comments