Skip to content

Commit 9f0fb19

Browse files
committed
Update git action and example codes.
1 parent b4651c3 commit 9f0fb19

File tree

4 files changed

+39
-18
lines changed

4 files changed

+39
-18
lines changed

.github/workflows/sdkbuild2run.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ jobs:
3333
run: |
3434
cd examples
3535
python .\Example_QuickStart.py
36+
python .\Example_CheckExcel.py
37+
python .\Example_CloudStorageManagement.py
38+
python .\Example_ConvertChartToImage.py
39+
python .\Example_ConvertRangeToImage.py
40+
python .\Example_ConvertExcel.py
41+
python .\Example_TextProcessing.py
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1+
import base64
12
import os
23
import shutil
3-
import base64
4+
45
from asposecellscloud.apis.cells_api import CellsApi
56
from asposecellscloud.models import *
67
from asposecellscloud.requests import *
78

8-
99
EmployeeSalesSummaryXlsx = "EmployeeSalesSummary.xlsx"
1010
RemoteFolder = "PythonSDK"
1111
# Get Cells Cloud SDK instance
1212
instance = CellsApi(os.getenv('CellsCloudClientId'),os.getenv('CellsCloudClientSecret'))
1313

14-
# Upload a local Excel file to Cells Cloud Storage.
14+
# 1. Cells Cloud V3.0: Convert chart to image
15+
# 1.1. Upload a local Excel file to Cells Cloud Storage.
1516
instance.upload_file( UploadFileRequest(EmployeeSalesSummaryXlsx, "PythonSDK/EmployeeSalesSummary.xlsx"))
16-
17+
# 1.2 Get chart image from Excel worksheet.
1718
request = GetWorksheetChartRequest( EmployeeSalesSummaryXlsx, 'Sales', 0,format= 'png',folder= 'PythonSDK',storage_name= '')
1819
tmp_path = instance.get_worksheet_chart(request)
19-
shutil.move( tmp_path ,"EmployeeSalesSummary_Sales.png")
20+
# 1.3 Save chart image to local file.
21+
shutil.move( tmp_path ,"EmployeeSalesSummary_Sales_v30.png")
22+
23+
# 2. Cells Cloud V3.0: Convert chart to image
24+
convertChartToImageRequest = ConvertChartToImageRequest( EmployeeSalesSummaryXlsx, 'Sales', 0,format= 'png')
25+
instance.convert_chart_to_image(convertChartToImageRequest ,local_outpath = "EmployeeSalesSummary_Sales_v40.png" )
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1+
import base64
12
import os
23
import shutil
3-
import base64
4+
45
from asposecellscloud.apis.cells_api import CellsApi
56
from asposecellscloud.models import *
67
from asposecellscloud.requests import *
78

8-
99
EmployeeSalesSummaryXlsx = "EmployeeSalesSummary.xlsx"
1010
RemoteFolder = "PythonSDK"
1111
# Get Cells Cloud SDK instance
1212
instance = CellsApi(os.getenv('CellsCloudClientId'),os.getenv('CellsCloudClientSecret'))
1313

14-
# Convert a local Excel file to another format file directly.
15-
response = instance.put_convert_workbook(PutConvertWorkbookRequest( EmployeeSalesSummaryXlsx, 'pdf'))
16-
shutil.move( response ,"EmployeeSalesSummary1.pdf")
17-
18-
# Upload a local Excel file to Cells Cloud Storage.
14+
# 1. Cells Cloud v3.0: Convert range to image
15+
# 1.1. Upload a local Excel file to Cells Cloud Storage.
1916
instance.upload_file( UploadFileRequest(EmployeeSalesSummaryXlsx, "PythonSDK/EmployeeSalesSummary.xlsx"))
20-
17+
# 1.2. Convert range to image
2118
source_range = Range(column_count= 11 ,first_column= 1 ,first_row= 25 ,row_count= 11 )
2219
image_options = ImageOrPrintOptions( image_type="svg" )
2320
range_convert_request = RangeConvertRequest( source=source_range, image_type="svg", image_or_print_options=image_options)
2421
request = PostWorksheetCellsRangeToImageRequest( name=EmployeeSalesSummaryXlsx, sheet_name="Sales",
2522
range_convert_request=range_convert_request, folder=RemoteFolder )
2623
tmp_path = instance.post_worksheet_cells_range_to_image(request)
27-
shutil.move( tmp_path ,"EmployeeSalesSummary_Sales.svg")
24+
# 1.3. Save image to local file.
25+
shutil.move( tmp_path ,"EmployeeSalesSummary_Sales_v30.svg")
26+
27+
# 2. Cells Cloud V4.0: Convert range to image
28+
# 2.1. convert range to image
29+
range_convert_request = ConvertRangeToImageRequest( EmployeeSalesSummaryXlsx, 'Sales', "B28:L36", "svg")
30+
instance.convert_range_to_image(range_convert_request ,local_outpath = "EmployeeSalesSummary_Sales_v40.svg" )

examples/Example_TextProcessing.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@
1111

1212
trimContentOptions = TrimContentOptions(
1313
data_source= DataSource(data_path="PythonSDK/BookText.xlsx", data_source_type="CloudFileSystem" ),
14-
remove_all_line_breaks = True, remove_extra_line_breaks= True,
14+
remove_all_line_breaks = True,
15+
remove_extra_line_breaks= True,
16+
remove_extra_spaces= True,
17+
trim_leading= True,
18+
trim_trailing= True,
19+
trim_content= ' ',
20+
trim_space_between_word_to1= True,
21+
trim_non_breaking_spaces= True,
1522
scope_options = ScopeOptions( scope= "Workbook")
1623
)
1724

@@ -22,8 +29,7 @@
2229

2330

2431
trimContentOptions.scope_options.scope = 'Worksheet'
25-
trimContentOptions.scope_options.scope_items = [ScopeItem()]
26-
trimContentOptions.scope_options.scope_items[0].worksheet_name = 'SDKs'
32+
trimContentOptions.scope_options.scope_items = [ScopeItem( worksheet='SDKs')]
2733
response = instance.post_trim_content( PostTrimContentRequest(trimContentOptions))
2834

2935
decoded_data = base64.b64decode(response.file_content)
@@ -32,7 +38,7 @@
3238
file.write(decoded_data)
3339

3440
trimContentOptions.scope_options.scope = 'SelectionOlny'
35-
trimContentOptions.scope_options.scope_items[0].worksheet_name = 'SDKs'
41+
trimContentOptions.scope_options.scope_items[0].worksheet = 'SDKs'
3642
trimContentOptions.scope_options.scope_items[0].ranges = ["B2:B2","B4:B4"]
3743
response = instance.post_trim_content( PostTrimContentRequest(trimContentOptions))
3844

0 commit comments

Comments
 (0)