Converti il file XLS con immagini o grafici nel formato PDF
Contents
[
Hide
]
Aspose.Cells supporta la conversione dei file XLS che contengono immagini e grafici in documenti PDF. Aspose.Cells for .NET può funzionare in modo indipendente per convertire un foglio di calcolo in PDF: non è richiesto Aspose.PDF for .NET per la conversione. Il processo può essere eseguito in memoria in quanto non dipende da file XML temporanei o intermediari. Questo significa che grandi file Excel, ad esempio quelli contenenti immagini, grafici e altri oggetti di disegno, possono essere convertiti rapidamente ed efficientemente.
Codice di Esempio
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); | |
try | |
{ | |
// Get the template excel file path. | |
string designerFile = dataDir + "SampleInput.xls"; | |
// Specify the pdf file path. | |
string pdfFile = dataDir + "Output.out.pdf"; | |
// Open the template excel file | |
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(designerFile); | |
// Save the pdf file. | |
wb.Save(pdfFile, SaveFormat.Pdf); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine(e.Message); | |
Console.ReadLine(); | |
} |
Se il foglio di calcolo contiene formule, è meglio chiamare il metodo Workbook.CalculateFormula appena prima del rendering in PDF. In questo modo si garantisce che i valori dipendenti dalla formula siano ricalcolati e i valori corretti vengano resi in PDF.