copy_format method

copy_format(source_index, destination_index)

Copies format from the source data point to the destination data point.

def copy_format(self, source_index: int, destination_index: int):
    ...
ParameterTypeDescription
source_indexint
destination_indexint

Examples

Shows how to copy data point format.

doc = aw.Document(file_name=MY_DIR + 'DataPoint format.docx')
# Get the chart and series to update format.
shape = doc.get_child(aw.NodeType.SHAPE, 0, True).as_shape()
series = shape.chart.series[0]
data_points = series.data_points
self.assertTrue(data_points.has_default_format(0))
self.assertFalse(data_points.has_default_format(1))
# Copy format of the data point with index 1 to the data point with index 2
# so that the data point 2 looks the same as the data point 1.
data_points.copy_format(0, 1)
self.assertTrue(data_points.has_default_format(0))
self.assertTrue(data_points.has_default_format(1))
# Copy format of the data point with index 0 to the series defaults so that all data points
# in the series that have the default format look the same as the data point 0.
series.copy_format_from(1)
self.assertTrue(data_points.has_default_format(0))
self.assertTrue(data_points.has_default_format(1))
doc.save(file_name=ARTIFACTS_DIR + 'Charts.CopyDataPointFormat.docx')

See Also