تحميل وإدارة ملفات إكسل، OpenOffice، Json، Csv و Html
Contents
[
Hide
]
مع Aspose.Cells، من السهل إنشاء، فتح، وإدارة ملفات إكسل، على سبيل المثال، لاسترجاع البيانات، أو استخدام قالب مصمم لتسريع عملية التطوير.
إنشاء مصنف جديد
يُظهر المثال التالي إنشاء دفتر عمل جديد من الصفر.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const licensePath = path.join(dataDir, "Aspose.Cells.lic");
try {
// Create a License object
const license = new AsposeCells.License();
// Set the license of Aspose.Cells to avoid the evaluation limitations
license.setLicense(licensePath);
} catch (ex) {
console.log(ex.message);
}
// Instantiate a Workbook object that represents Excel file.
const wb = new AsposeCells.Workbook();
// When you create a new workbook, a default "Sheet1" is added to the workbook.
const sheet = wb.getWorksheets().get(0);
// Access the "A1" cell in the sheet.
const cell = sheet.getCells().get("A1");
// Input the "Hello World!" text into the "A1" cell
cell.putValue("Hello World!");
// Save the Excel file.
wb.save(path.join(dataDir, "MyBook_out.xlsx"));
فتح وحفظ ملف
مع Aspose.Cells، من السهل فتح، حفظ، وإدارة ملفات إكسل.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Opening through Path
// Creating a Workbook object and opening an Excel file using its file path
const workbook1 = new AsposeCells.Workbook(path.join(dataDir, "Book1.xlsx"));
// Adding new sheet
const sheet = workbook1.getWorksheets().add("MySheet");
// Setting active sheet
workbook1.getWorksheets().setActiveSheetIndex(1);
// Setting values.
const cells = sheet.getCells();
// Setting text
cells.get("A1").putValue("Hello!");
// Setting number
cells.get("A2").putValue(1000);
// Setting Date Time
const cell = cells.get("A3");
cell.putValue(new Date());
const style = cell.getStyle();
style.setNumber(14);
cell.setStyle(style);
// Setting formula
cells.get("A4").setFormula("=SUM(A1:A3)");
// Saving the workbook to disk.
workbook1.save(path.join(dataDir, "dest.xlsx"));
مواضيع متقدمة
- طرق مختلفة لفتح الملفات
- تصفية أسماء محددة أثناء تحميل المصنف
- تصفية الكائنات أثناء تحميل مصنف العمل أو ورقة العمل
- تصفية نوع البيانات أثناء تحميل مصنف العمل من ملف القالب
- الحصول على تحذيرات أثناء تحميل ملف إكسل
- تحميل ملف Excel المصدر دون الرسوم البيانية
- تحميل الأوراق العمل المحددة في كتيب عمل
- تحميل الدفتر بحجم ورقة الطابعة المحدد
- فتح ملفات Microsoft Excel مختلفة الإصدارات
- فتح الملفات بتنسيقات مختلفة
- تحسين استخدام الذاكرة أثناء العمل مع ملفات كبيرة تحتوي على مجموعات بيانات كبيرة
- قراءة جدول بيانات الأرقام المطور من قبل Apple Inc. باستخدام Aspose.Cells
- توقّف عن التحويل أو التحميل باستخدام InterruptMonitor عندما يستغرق وقتًا طويلاً
- استخدام واجهة برمجة التطبيقات LightCells
- تحويل CSV إلى JSON
- تحويل إكسل إلى JSON
- تحويل JSON إلى CSV
- تحويل JSON إلى إكسل
- تحويل إكسل إلى Html