تحويل ملف XLS الذي يحتوي على صور أو رسومات إلى PDF
Contents
[
Hide
]
تدعم Aspose.Cells لـ Python via .NET تحويل ملفات XLS الذي تحتوي على صور ورسوم بيانية إلى مستندات PDF. يمكن لـ Aspose.Cells لـ Python via .NET API العمل بشكل مستقل لتحويل جدول بيانات إلى PDF: لا يُطلب Aspose.PDF for .NET للتحويل. يمكن إجراء العملية في الذاكرة نظرًا لعدم اعتماد العملية على ملفات XML مؤقتة أو وسيطة. يعني هذا أنه يمكن تحويل ملفات Excel كبيرة، على سبيل المثال، تلك التي تحتوي على صور ورسوم بيانية وكائنات رسم أخرى، بسرعة وبكفاءة.
الكود المثالي
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
from aspose.cells import SaveFormat, Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
try: | |
# Get the template excel file path. | |
designerFile = dataDir + "SampleInput.xls" | |
# Specify the pdf file path. | |
pdfFile = dataDir + "Output.out.pdf" | |
# Open the template excel file | |
wb = Workbook(designerFile) | |
# Save the pdf file. | |
wb.save(pdfFile, SaveFormat.PDF) | |
except Exception as e: | |
print(str(e)) | |
input() |
إذا كان جدول الجداول يحتوي على صيغ، من الأفضل استدعاء طريقة Workbook.calculate_formula مباشرة قبل التقديم إلى PDF. يضمن ذلك إعادة حساب القيم التي تعتمد على الصيغ، وتقديم القيم الصحيحة في PDF.