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.SheetSet seçeneğine ayarlayarak bunu kolayca yapabilirsiniz.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Get the Excel file path
string filePath = dataDir + "input.xlsx";
// Instantiage a new workbook and open the Excel, File from its location
Workbook workbook = new Workbook(filePath);
// Get the count of the worksheets in the workbook
int sheetCount = workbook.Worksheets.Count;
// Define PdfSaveOptions
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
// Take Pdfs of each sheet
for (int j = 0; j < sheetCount; j++)
{
Worksheet ws = workbook.Worksheets[j];
//set worksheet to output
SheetSet sheetSet = new SheetSet(new int[] { ws.Index });
pdfSaveOptions.SheetSet = sheetSet;
workbook.Save(dataDir + "worksheet-" + ws.Name + ".out.pdf", pdfSaveOptions);
}