Example #1
0
    def test_cells_ranges_post_worksheet_cells_ranges(self):
        """
        Test case for cells_ranges_post_worksheet_cells_ranges

        copy range in the worksheet
        """
        name = 'Book1.xlsx'
        sheet_name = 'Sheet1'
        rangeOperate = RangeCopyRequest()
        rangeOperate.operate = "copydata"
        pasteOptions = PasteOptions()
        pasteOptions.only_visible_cells = True
        rangeOperate.paste_options = pasteOptions
        range = Range(column_count=1,
                      column_width=10.1,
                      first_column=1,
                      first_row=1,
                      row_count=10,
                      row_height=10)
        range2 = Range(column_count=1,
                       column_width=10.1,
                       first_column=10,
                       first_row=10,
                       row_count=10,
                       row_height=10)
        rangeOperate.source = range
        rangeOperate.target = range2
        folder = "Temp"
        AuthUtil.Ready(name, folder)
        result = self.api.cells_ranges_post_worksheet_cells_ranges(
            name, sheet_name, range_operate=rangeOperate, folder=folder)
        pass
Example #2
0
    def test_cells_ranges_post_worksheet_cells_range_value(self):
        """
        Test case for cells_ranges_post_worksheet_cells_range_value

        Puts a value into the range, if appropriate the value will be converted to other data type and cell's number format will be reset.             
        """
        name = 'Book1.xlsx'
        sheet_name = 'Sheet1'
        value = "null"
        range = Range(column_count=1,
                      column_width=10.1,
                      first_column=1,
                      first_row=1,
                      row_count=10,
                      row_height=10)
        isConverted = True
        setStyle = True
        folder = "Temp"
        AuthUtil.Ready(name, folder)
        result = self.api.cells_ranges_post_worksheet_cells_range_value(
            name,
            sheet_name,
            value,
            range=range,
            is_converted=isConverted,
            set_style=setStyle,
            folder=folder)
        pass
Example #3
0
    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
Example #4
0
    def test_cells_ranges_post_worksheet_cells_range_outline_border(self):
        """
        Test case for cells_ranges_post_worksheet_cells_range_outline_border

        Sets outline border around a range of cells.
        """
        name = 'Book1.xlsx'
        sheet_name = 'Sheet1'
        rangeOperate = RangeSetOutlineBorderRequest()
        rangeOperate.border_edge = "LeftBorder"
        rangeOperate.border_style = "Dotted"
        color = Color(0, 255, 0, 0)
        rangeOperate.border_color = color
        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_outline_border(
            name, sheet_name, range_operate=rangeOperate, folder=folder)
        pass
Example #5
0
    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
Example #6
0
    def test_cells_ranges_post_worksheet_cells_range_merge(self):
        """
        Test case for cells_ranges_post_worksheet_cells_range_merge

        Combines a range of cells into a single cell.              
        """
        name = 'Book1.xlsx'
        sheet_name = 'Sheet1'
        range = Range(column_count=1,
                      column_width=10.1,
                      first_column=1,
                      first_row=1,
                      row_count=10,
                      row_height=10)
        folder = "Temp"
        AuthUtil.Ready(name, folder)
        result = self.api.cells_ranges_post_worksheet_cells_range_merge(
            name, sheet_name, range=range, folder=folder)
        pass
Example #7
0
    def test_cells_ranges_post_worksheet_cells_range_unmerge(self):
        """
        Test case for cells_ranges_post_worksheet_cells_range_unmerge

        Unmerges merged cells of this range.             
        """
        name = 'Book1.xlsx'
        sheet_name = 'Sheet1'
        range = Range(column_count=1,
                      column_width=10.1,
                      first_column=1,
                      first_row=1,
                      row_count=10,
                      row_height=10)
        folder = "Temp"
        AuthUtil.Ready(name, folder)
        result = self.api.cells_ranges_post_worksheet_cells_range_unmerge(
            name, sheet_name, range=range, folder=folder)
        pass
Example #8
0
    def test_cells_ranges_post_worksheet_cells_range_column_width(self):
        """
        Test case for cells_ranges_post_worksheet_cells_range_column_width

        Set column width of range
        """
        name = 'Book1.xlsx'
        sheet_name = 'Sheet1'
        value = 10.01
        range = Range(column_count=1,
                      column_width=10.1,
                      first_column=1,
                      first_row=1,
                      row_count=10,
                      row_height=10)
        folder = "Temp"
        AuthUtil.Ready(name, folder)
        result = self.api.cells_ranges_post_worksheet_cells_range_column_width(
            name, sheet_name, value, range=range, folder=folder)
        pass
Example #9
0
    def test_cells_ranges_post_worksheet_cells_range_move_to(self):
        """
        Test case for cells_ranges_post_worksheet_cells_range_move_to

        Move the current range to the dest range.             
        """
        name = 'Book1.xlsx'
        sheet_name = 'Sheet1'
        destRow = 1
        destColumn = 1
        range = Range(column_count=1,
                      column_width=10.1,
                      first_column=1,
                      first_row=1,
                      row_count=10,
                      row_height=10)
        folder = "Temp"
        AuthUtil.Ready(name, folder)
        result = self.api.cells_ranges_post_worksheet_cells_range_move_to(
            name, sheet_name, destRow, destColumn, range=range, folder=folder)
        pass
Example #10
0
    def test_cells_ranges_post_worksheet_cells_range_unmerge(self):
        """
        Test case for cells_ranges_post_worksheet_cells_range_unmerge

        Unmerges merged cells of this range.             
        """
        name = 'Book1.xlsx'
        sheet_name = 'Sheet1'
        range = Range(column_count=1,
                      column_width=10.1,
                      first_column=1,
                      first_row=1,
                      row_count=10,
                      row_height=10)
        folder = "PythonTest"
        result = AuthUtil.Ready(self.api, name, folder)
        self.assertTrue(len(result.uploaded) > 0)
        result = self.api.cells_ranges_post_worksheet_cells_range_unmerge(
            name, sheet_name, range=range, folder=folder)
        self.assertEqual(result.code, 200)
        pass
Example #11
0
    def test_cells_ranges_post_worksheet_cells_range_move_to(self):
        """
        Test case for cells_ranges_post_worksheet_cells_range_move_to

        Move the current range to the dest range.             
        """
        name = 'Book1.xlsx'
        sheet_name = 'Sheet1'
        destRow = 1
        destColumn = 1
        range = Range(column_count=1,
                      column_width=10.1,
                      first_column=1,
                      first_row=1,
                      row_count=10,
                      row_height=10)
        folder = "PythonTest"
        result = AuthUtil.Ready(self.api, name, folder)
        self.assertTrue(len(result.uploaded) > 0)
        result = self.api.cells_ranges_post_worksheet_cells_range_move_to(
            name, sheet_name, destRow, destColumn, range=range, folder=folder)
        self.assertEqual(result.code, 200)
        pass