تحميل وإدارة ملفات Excel، OpenOffice، Json، Csv و Html
Contents
[
Hide
]
مع Aspose.Cells for Python via .NET، من السهل إنشاء وفتح وإدارة ملفات Excel، على سبيل المثال، لاسترجاع البيانات، أو لاستخدام قالب مصمم لتسريع عملية التطوير.
إنشاء مصنف جديد
المثال التالي ينشئ مصنفاً جديداً من البداية.
This file contains hidden or 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 License, 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: | |
# Create a License object | |
license = License() | |
# Set the license of Aspose.Cells to avoid the evaluation limitations | |
license.set_license(dataDir + "Aspose.Cells.lic") | |
except Exception as ex: | |
print(str(ex)) | |
# Instantiate a Workbook object that represents Excel file. | |
wb = Workbook() | |
# When you create a new workbook, a default "Sheet1" is added to the workbook. | |
sheet = wb.worksheets[0] | |
# Access the "A1" cell in the sheet. | |
cell = sheet.cells.get("A1") | |
# Input the "Hello World!" text into the "A1" cell | |
cell.put_value("Hello World!") | |
# Save the Excel file. | |
wb.save(dataDir + "MyBook_out.xlsx") |
فتح وحفظ ملف
مع Aspose.Cells for Python via .NET، من السهل فتح، حفظ وإدارة ملفات Excel.
This file contains hidden or 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 Workbook | |
from datetime import datetime | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
dataDir = RunExamples.GetDataDir(".") | |
# Opening through Path | |
# Creating a Workbook object and opening an Excel file using its file path | |
workbook1 = Workbook(dataDir + "Book1.xlsx") | |
# Adding new sheet | |
sheet = workbook1.worksheets.add("MySheet") | |
# Setting active aheet | |
workbook1.worksheets.active_sheet_index = 1 | |
# Setting values. | |
cells = sheet.cells | |
# Setting text | |
cells.get("A1").put_value("Hello!") | |
# Setting number | |
cells.get("A2").put_value(1000) | |
# Setting Date Time | |
cell = cells.get("A3") | |
cell.value = datetime.now() | |
style = cell.get_style() | |
style.number = 14 | |
cell.set_style(style) | |
# Setting formula | |
cells.get("A4").formula = "=SUM(A1:A3)" | |
# Saving the workbook to disk. | |
workbook1.save(dir + "dest.xlsx") |
مواضيع متقدمة
- طرق مختلفة لفتح الملفات
- تصفية أسماء محددة أثناء تحميل المصنف
- تصفية الكائنات أثناء تحميل مصنف العمل أو ورقة العمل
- تصفية نوع البيانات أثناء تحميل مصنف العمل من ملف القالب
- تحميل ملف Excel المصدر دون الرسوم البيانية
- تحميل الدفتر بحجم ورقة الطابعة المحدد
- فتح ملفات Microsoft Excel مختلفة الإصدارات
- فتح الملفات بتنسيقات مختلفة
- تحسين استخدام الذاكرة أثناء العمل مع ملفات كبيرة تحتوي على مجموعات بيانات كبيرة
- قراءة جدول بيانات الأرقام المطور من قبل Apple Inc. باستخدام Aspose.Cells