Konvertierung von XLS Datei mit Bildern oder Diagrammen in PDF
Contents
[
Hide
]
Aspose.Cells unterstützt die Konvertierung von XLS-Dateien, die Bilder und Diagramme enthalten, in PDF-Dokumente. Aspose.Cells for .NET kann unabhängig voneinander arbeiten, um eine Tabelle in PDF umzuwandeln: Aspose.PDF für .NET ist für die Konvertierung nicht erforderlich. Der Vorgang kann im Speicher durchgeführt werden, da er nicht von temporären oder zwischengeschalteten XML-Dateien abhängt. Dies bedeutet, dass große Excel-Dateien, die beispielsweise Bilder, Diagramme und andere Zeichenobjekte enthalten, schnell und effizient konvertiert werden können.
Beispielcode
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(); | |
} |
Wenn die Tabelle Formeln enthält, ist es am besten, die Methode Workbook.CalculateFormula kurz vor der Konvertierung in PDF aufzurufen. Dadurch wird sichergestellt, dass formelabhängige Werte neu berechnet werden und die richtigen Werte im PDF gerendert werden.