Çalışsayfa Kopyalama ve Taşıma

Microsoft Excel kullanarak Sayfaları Taşıma veya Kopyalama

Microsoft Excel’de çalışma kitapları arasında veya içinde çalışma sayfalarını kopyalama ve taşıma için gereken adımlar aşağıda listelenmiştir.

  1. Sayfaları başka bir çalışma kitabına taşımak veya kopyalamak için, sayfaları alacak olan çalışma kitabını açın.
  2. Taşımak veya kopyalamak istediğiniz sayfaları içeren çalışma kitabına geçin ve ardından sayfaları seçin.
  3. Düzenle menüsünde, Sayfayı Taşı veya Kopyala‘yı tıklayın.
  4. Kitapçığa iletişim kutusunda, sayfaların alınacağı çalışma kitabını tıklayın.
  5. Seçili sayfaları yeni bir kitapçığa taşımak veya kopyalamak için Yeni Kitap‘a tıklayın.
  6. Önceki sayfa kutusunda, taşınan veya kopyalanan sayfaların nereden önce ekleneceğini tıklayın.
  7. Sayfaları taşımak yerine kopyalamak için Kopyasını Oluştur onay kutusunu seçin.

Bir Çalışma Kitabını Kopyalama Aspose.Cells for Python Excel Kütüphanesi ile nasıl yapılır

Aspose.Cells for Python via .NET, veri kopyalamak ve biçimlendirmeyi başka bir çalışma sayfasına kopyalamak için Aspose.Cells.WorksheetCollection.add_copy() adlı aşırı yüklenmiş bir yöntem sağlar. Bu yöntemden biri, kaynak çalışma sayfası indeksini parametre olarak alır. Diğeri ise kaynak çalışma sayfasının adını kullanır.

Aşağıdaki örnek, bir çalışma kitabı içinde mevcut bir çalışma sayfasının nasıl kopyalanacağını gösterir.

from aspose.cells import Workbook
# 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(".")
InputPath = dataDir + "book1.xls"
# Open an existing Excel file.
wb = Workbook(InputPath)
# Create a Worksheets object with reference to
# the sheets of the Workbook.
sheets = wb.worksheets
# Copy data to a new sheet from an existing
# sheet within the Workbook.
sheets.add_copy("Sheet1")
# Save the Excel file.
wb.save(dataDir + "CopyWithinWorkbook_out.xls")

Çalışma Kitapları Arasında Sayfaları Kopyalama

Aspose.Cells for Python via .NET, kaynak çalışma sayfasından başka bir çalışma sayfasına veya başka çalışma kitapları arasında veri ve biçimlendirmeyi kopyalamak için Aspose.Cells.Worksheet.copy() yöntemini sağlar. Bu yöntem, kaynak çalışma sayfası nesnesini parametre olarak alır.

Aşağıdaki örnek, bir çalışma kitabından diğer bir çalışma kitabına sayfa kopyalamanın nasıl yapılacağını gösterir.

from aspose.cells import Workbook
# 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(".")
InputPath = dataDir + "book1.xls"
# Create a Workbook.
# Open a file into the first book.
excelWorkbook0 = Workbook(InputPath)
# Create another Workbook.
excelWorkbook1 = Workbook()
# Copy the first sheet of the first book into second book.
excelWorkbook1.worksheets[0].copy(excelWorkbook0.worksheets[0])
# Save the file.
excelWorkbook1.save(dataDir + "CopyWorksheetsBetweenWorkbooks_out.xls")

Aşağıdaki örnek, bir çalışma kitabından başka bir çalışma kitabına bir çalışma sayfasını kopyalamayı 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
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
# Create a new Workbook.
excelWorkbook0 = Workbook()
# Get the first worksheet in the book.
ws0 = excelWorkbook0.worksheets[0]
# Put some data into header rows (A1:A4)
for i in range(5):
headerRow = "Header Row " + str(i)
ws0.cells.get(i, 0).put_value(headerRow)
# Put some detail data (A5:A999)
for i in range(5, 1000):
detailRow = "Detail Row " + str(i)
ws0.cells.get(i, 0).put_value(detailRow)
# Define a pagesetup object based on the first worksheet.
pagesetup = ws0.page_setup
# The first five rows are repeated in each page...
# It can be seen in print preview.
pagesetup.print_title_rows = "$1:$5"
# Create another Workbook.
excelWorkbook1 = Workbook()
# Get the first worksheet in the book.
ws1 = excelWorkbook1.worksheets[0]
# Name the worksheet.
ws1.name = "MySheet"
# Copy data from the first worksheet of the first workbook into the
# first worksheet of the second workbook.
ws1.copy(ws0)
# Save the excel file.
excelWorkbook1.save(dataDir + "CopyWorksheetFromWorkbookToOther_out.xls")

Çalışma Kitabı İçinde Sayfaları Taşıma

Aspose.Cells for Python via .NET, aynı elektronik tabloda başka bir konuma sayfa taşımak için Aspose.Cells.Worksheet.move_to() yöntemini sağlar. Bu yöntem, hedef çalışma sayfası indeksini parametre olarak alır.

Aşağıdaki örnek, bir çalışma kitabı içinde bir çalışma sayfasının başka bir konuma nasıl taşınacağını gösterir.

from aspose.cells import Workbook
# 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(".")
InputPath = dataDir + "book1.xls"
# Open an existing excel file.
wb = Workbook(InputPath)
# Create a Worksheets object with reference to
# the sheets of the Workbook.
sheets = wb.worksheets
# Get the first worksheet.
worksheet = sheets[0]
# Move the first sheet to the third position in the workbook.
worksheet.move_to(2)
# Save the excel file.
wb.save(dataDir + "MoveWorksheet_out.xls")