Çalışsayfalar Arasında Şekiller Kopyalama

Bir Resmi Bir Çalışsayfasından Başka Birine Kopyalama

Bir resmi bir çalışsayfasından diğerine kopyalamak için aşağıdaki örnek kodda gösterildiği gibi Worksheet.pictures.add yöntemini kullanın.

from aspose.cells import Workbook
from io import BytesIO
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
# Open the template file
workbook = Workbook(dataDir + "sample.xlsx")
# Get the Picture from the "Picture" worksheet.
picturesource = workbook.worksheets.get("Picture").pictures[0]
# Save Picture to Memory Stream
ms = BytesIO(picturesource.data)
# Copy the picture to the Result Worksheet
workbook.worksheets.get("Result").pictures.add(picturesource.upper_left_row, picturesource.upper_left_column, ms, picturesource.width_scale, picturesource.height_scale)
# Save the Worksheet
workbook.save(dataDir + "PictureCopied_out.xlsx")

Bir Grafik Bir Çalışsayfasından Diğerine Kopyalama

Aşağıdaki kod, bir çalışsayfasından diğerine bir grafik kopyalamak için Worksheet.shapes.add_copy yönteminin kullanımını göstermektedir.

from aspose.cells import Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# Open the template file
workbook = Workbook(dataDir + "sample.xlsx")
# Get the Chart from the "Chart" worksheet.
chartsource = workbook.worksheets.get("Chart").charts[0]
cshape = chartsource.chart_object
# Copy the Chart to the Result Worksheet
workbook.worksheets.get("Result").shapes.add_copy(cshape, 20, 0, 2, 0)
# Save the Worksheet
workbook.save(dataDir + "ChartCopied_out.xlsx")

Denetimleri ve Diğer Çizim Nesnelerini Bir Çalışsayfasından Diğerine Kopyalama

Denetimleri ve diğer çizim nesnelerini kopyalamak için örnekte gösterildiği gibi Worksheet.shapes.add_copy yöntemini kullanın.

from aspose.cells import Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# Open the template file
workbook = Workbook(dataDir + "sample2.xlsx")
# Get the Shapes from the "Control" worksheet.
shape = workbook.worksheets.get("Control").shapes
# Copy the Textbox to the Result Worksheet
workbook.worksheets.get("Result").shapes.add_copy(shape[0], 5, 0, 2, 0)
# Copy the Oval Shape to the Result Worksheet
workbook.worksheets.get("Result").shapes.add_copy(shape[1], 10, 0, 2, 0)
# Save the Worksheet
workbook.save(dataDir + "ControlsCopied_out.xlsx")