Her Çalışma Sayfasını Farklı Bir PDF Dosyasına Kaydet

Contents
[ ]

Farklı PDF dosyaları oluşturmak için şablon Excel dosyanızdaki her çalışma sayfasını kaydetmeniz gerekiyorsa. Bu kolayca elde edilebilir. Dosyadaki sayfaları gizlemeyi deneyebilir ve PDF’leri oluşturacağınız sayfaya bağlı olarak her seferinde bir sayfayı görünür hale getirebilirsiniz.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(SaveEachWorksheettoDifferentPDF.class);
// Instantiate a new workbook and open the Excel
// File from its location
Workbook workbook = new Workbook(dataDir + "input.xlsx");
// Get the count of the worksheets in the workbook
int sheetCount = workbook.getWorksheets().getCount();
// Define PdfSaveOptions
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
// Take Pdfs of each sheet
for (int j = 0; j < sheetCount; j++) {
Worksheet ws = workbook.getWorksheets().get(j);
//set worksheet to output
SheetSet sheetSet = new SheetSet(new int[] { ws.getIndex() });
pdfSaveOptions.setSheetSet(sheetSet);
workbook.save(dataDir + "_" + ws.getName() + ".pdf", pdfSaveOptions);
}