Oluşturulan Sayfa Sayısını Sınırlandır Excel den PDF ye Dönüşüm
Contents
[
Hide
]
Bazı durumlarda, bir dizi sayfayı bir çıktı PDF dosyasına yazdırmak istersiniz. Aspose.Cells, bir Excel elektronik tablosunu PDF’ye dönüştürürken kaç sayfa oluşturulacağına sınırlama getirme yeteneğine sahiptir.
Oluşturulan Sayfa Sayısını Sınırlandırmak
Aşağıdaki örnek, bir Microsoft Excel dosyasındaki (3 ve 4) sayfa aralığını PDF olarak nasıl oluşturacağını göstermektedir.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(LimitNumberofPagesGenerated.class); | |
// Open an Excel file | |
Workbook wb = new Workbook(dataDir + "TestBook.xlsx"); | |
// Instantiate the PdfSaveOption | |
PdfSaveOptions options = new PdfSaveOptions(); | |
// Print only Page 3 and Page 4 in the output PDF | |
// Starting page index (0-based index) | |
options.setPageIndex(2); | |
// Number of pages to be printed | |
options.setPageCount(2); | |
// Save the PDF file | |
wb.save(dataDir + "outPDF1.pdf", options); |
Eğer elektronik tablo formüller içeriyorsa, Excel elektronik tablosunu PDF biçimine dönüştürmeden hemen önce Workbook.calculateFormula çağrısını yapmak en iyisidir. Bunu yapmak, formül bağımlı değerlerin yeniden hesaplanmasını sağlar ve doğru değerler çıktı dosyasında görüntülenir.