Her bir Çalışsayfayı Farklı Bir PDF Dosyasına Kaydet

Her Çalışsayarı Farklı Bir PDF Dosyasına Kaydet

Şablon Excel dosyanızdaki her bir çalışsayfayı farklı PDF dosyaları oluşturmak için bu işlemi kolayca gerçekleştirebilirsiniz. PDF’ye dönüştürme işlemi sırasında bir çalışsayfa indeksini PdfSaveOptions.sheet_set seçeneğine ayarlayarak bunu kolayca yapabilirsiniz.

from aspose.cells import PdfSaveOptions, Workbook
from aspose.cells.rendering import SheetSet
# 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(".")
# Get the Excel file path
filePath = dataDir + "input.xlsx"
# Instantiage a new workbook and open the Excel, File from its location
workbook = Workbook(filePath)
# Get the count of the worksheets in the workbook
sheetCount = len(workbook.worksheets)
# Define PdfSaveOptions
pdfSaveOptions = PdfSaveOptions()
# Take Pdfs of each sheet
for j in range(sheetCount):
ws = workbook.worksheets[j]
# set worksheet to output
sheetSet = SheetSet([ws.index])
pdfSaveOptions.sheet_set = sheetSet
workbook.save(dataDir + "worksheet-" + ws.name + ".out.pdf", pdfSaveOptions)