def test_cells_ranges_post_worksheet_cells_range_style(self): """ Test case for cells_ranges_post_worksheet_cells_range_style Sets the style of the range. """ name = 'Book1.xlsx' sheet_name = 'Sheet1' rangeOperate = RangeSetStyleRequest() style = Style() font = Font() font.size = 10 style.font = font rangeOperate.style = style range = Range(column_count=1, column_width=10.1, first_column=1, first_row=1, row_count=10, row_height=10) rangeOperate.range = range folder = "Temp" AuthUtil.Ready(name, folder) result = self.api.cells_ranges_post_worksheet_cells_range_style( name, sheet_name, range_operate=rangeOperate, folder=folder) pass
def test_cells_post_update_worksheet_cell_style(self): """ Test case for cells_post_update_worksheet_cell_style Update cell's style. """ name = 'Book1.xlsx' sheet_name = 'Sheet1' cellName = 'C1' style = Style() font = Font() font.is_bold = True font.size = 10 style.font = font folder = "PythonTest" result = AuthUtil.Ready(self.api, name, folder) self.assertTrue(len(result.uploaded) > 0) result = self.api.cells_post_update_worksheet_cell_style(name, sheet_name, cellName, style=style, folder=folder) self.assertEqual(result.code, 200) pass
def test_cells_ranges_post_worksheet_cells_range_style(self): """ Test case for cells_ranges_post_worksheet_cells_range_style Sets the style of the range. """ name = 'Book1.xlsx' sheet_name = 'Sheet1' rangeOperate = RangeSetStyleRequest() style = Style() font = Font() font.size = 10 style.font = font rangeOperate.style = style range = Range(column_count=1, column_width=10.1, first_column=1, first_row=1, row_count=10, row_height=10) rangeOperate.range = range folder = "PythonTest" result = AuthUtil.Ready(self.api, name, folder) self.assertTrue(len(result.uploaded) > 0) result = self.api.cells_ranges_post_worksheet_cells_range_style( name, sheet_name, range_operate=rangeOperate, folder=folder) self.assertEqual(result.code, 200) pass
def test_cells_post_row_style(self): """ Test case for cells_post_row_style Set row style. """ name = 'Book1.xlsx' sheet_name = 'Sheet1' rowIndex = 1 style = Style() font = Font() font.is_bold = True font.size = 10 style.font = font folder = "PythonTest" result = AuthUtil.Ready(self.api, name, folder) self.assertTrue(len(result.uploaded) > 0) result = self.api.cells_post_row_style(name, sheet_name, rowIndex, style=style, folder=folder) self.assertEqual(result.code, 200) pass
def test_cells_pivot_tables_post_pivot_table_cell_style(self): """ Test case for cells_pivot_tables_post_pivot_table_cell_style Update cell style for pivot table """ name = 'TestCase.xlsx' sheet_name = 'Sheet4' pivotTableIndex = 0 column = 1 row = 1 style = Style() font = Font() font.size = 17 style.font = font needReCalculate = True folder = "Temp" AuthUtil.Ready(name, folder) result = self.api.cells_pivot_tables_post_pivot_table_cell_style( name, sheet_name, pivotTableIndex, column, row, style=style, need_re_calculate=needReCalculate, folder=folder) pass
def test_cells_pivot_tables_post_pivot_table_style(self): """ Test case for cells_pivot_tables_post_pivot_table_style Update style for pivot table """ name = 'TestCase.xlsx' sheet_name = 'Sheet4' pivotTableIndex = 0 style = Style() font = Font() font.size = 17 style.font = font needReCalculate = True folder = "PythonTest" result = AuthUtil.Ready(self.api, name, folder) self.assertTrue(len(result.uploaded) > 0) result = self.api.cells_pivot_tables_post_pivot_table_style( name, sheet_name, pivotTableIndex, style=style, need_re_calculate=needReCalculate, folder=folder) self.assertEqual(result.code, 200) pass
def test_cells_post_cell_characters(self): """ Test case for cells_post_cell_characters Set cell characters """ name ='Book1.xlsx' sheet_name ='Sheet2' cellName = 'G8' font = Font() font.size = 10.0 fs1 = FontSetting(font, 2, 0) options = [fs1] folder = "Temp" AuthUtil.Ready(name, folder) self.api.cells_post_cell_characters(name, sheet_name, cellName, options=options, folder=folder) pass
def test_cells_post_update_worksheet_range_style(self): """ Test case for cells_post_update_worksheet_range_style Update cell's range style. """ name ='Book1.xlsx' sheet_name ='Sheet1' range = 'C1:F10' style = Style() font = Font() font.is_bold = True font.size = 10 style.font = font folder = "Temp" AuthUtil.Ready(name, folder) self.api.cells_post_update_worksheet_range_style(name, sheet_name, range, style=style, folder=folder) pass
def test_cells_post_row_style(self): """ Test case for cells_post_row_style Set row style. """ name ='Book1.xlsx' sheet_name ='Sheet1' rowIndex = 1 style = Style() font = Font() font.is_bold = True font.size = 10 style.font = font folder = "Temp" AuthUtil.Ready(name, folder) self.api.cells_post_row_style(name, sheet_name, rowIndex, style=style,folder=folder) pass
import os import sys ABSPATH = os.path.abspath(os.path.realpath(os.path.dirname(__file__)) + "/..") sys.path.append(ABSPATH) import asposecellscloud from asposecellscloud.rest import ApiException from asposecellscloud.apis.cells_api import CellsApi import AuthUtil from asposecellscloud.models import CalculationOptions from asposecellscloud.models import FontSetting from asposecellscloud.models import Font from asposecellscloud.models import Style api_client = AuthUtil.GetApiClient() api = asposecellscloud.apis.cells_api.CellsApi(api_client) name ='TestCase.xlsx' sheet_name ='Sheet4' pivotTableIndex = 0 column = 1 row = 1 style = Style() font = Font() font.size = 17 style.font = font needReCalculate = True folder = "Temp" AuthUtil.Ready(name, folder) result = self.api.cells_pivot_tables_post_pivot_table_cell_style(name, sheet_name, pivotTableIndex ,column,row ,style=style,need_re_calculate=needReCalculate ,folder=folder)
import os import sys ABSPATH = os.path.abspath(os.path.realpath(os.path.dirname(__file__)) + "/..") sys.path.append(ABSPATH) import asposecellscloud from asposecellscloud.rest import ApiException from asposecellscloud.apis.cells_api import CellsApi import AuthUtil from asposecellscloud.models import CalculationOptions from asposecellscloud.models import FontSetting from asposecellscloud.models import Font from asposecellscloud.models import Style api_client = AuthUtil.GetApiClient() api = asposecellscloud.apis.cells_api.CellsApi(api_client) name ='Book1.xlsx' sheet_name ='Sheet1' cellName = 'C1' style = Style() font = Font() font.is_bold = True font.size = 10 style.font = font folder = "Temp" AuthUtil.Ready(name, folder) self.api.cells_post_update_worksheet_cell_style(name, sheet_name, cellName, style=style, folder = folder)
#Instantiate Aspose Storage API SDK storage_apiClient = asposestoragecloud.ApiClient.ApiClient( apiKey, appSid, True) storageApi = StorageApi(storage_apiClient) #Instantiate Aspose Cells API SDK api_client = asposecellscloud.ApiClient.ApiClient(apiKey, appSid, True) cellsApi = CellsApi(api_client) #set input file name filename = "Sample_Test_Book.xls" sheetName = "Sheet1" cellName = "A2" body = Style.Style() font = Font.Font() font.Name = "Calibri" font.Size = 40 body.Font = font #upload file to aspose cloud storage storageApi.PutCreate(Path=filename, file=data_folder + filename) try: #invoke Aspose.Cells Cloud SDK API to set the styles of selected cells in a worksheet response = cellsApi.PostUpdateWorksheetCellStyle(name=filename, sheetName=sheetName, cellName=cellName, body=body) if response.Status == "OK":