Her Çalışma Sayfasını Farklı Bir PDF Dosyasına Kaydet
Contents
[
Hide
]
Aspose.Cells, XLS dosyalarının (resimler, çizelgeler vb. içeren) PDF belgelerine dönüştürülmesini destekler. Aspose.Cells for .NET bir elektronik tabloyu PDF’e dönüştürmek için bağımsız olarak çalışabilir ve dönüştürme için Aspose.PDF for .NET kullanmanıza gerek yoktur. Tüm işlem bellekte yapılabildiğinden dönüştürme, yazılımın herhangi bir geçici dosya oluşturmasını veya kullanmasını gerektirmez.
Her Çalışma Sayfasını Farklı Bir PDF Dosyasına Kaydet
Farklı PDF dosyaları oluşturmak için her çalışma sayfasını şablon Excel dosyanıza kaydetmeniz gerekiyorsa, bunu kolayca yapabilirsiniz. PDF’e oluşturmak için dosyadaki sayfaları gizlemeyi ve her seferinde bir sayfayı görünür yapmayı deneyebilirsiniz.
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-.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); | |
} |
E-tablonuz formüller içeriyorsa, aramak en iyisidirWorkbook.CalculateFormula()elektronik tabloyu PDF biçimine dönüştürmeden hemen önce. Bunu yapmak, formüle bağlı değerlerin yeniden hesaplanmasını ve PDF’de doğru değerlerin oluşturulmasını sağlar.