البدء

التثبيت

ثبت Aspose.Cells عبر NuGet

NuGet هو أسهل طريقة لتنزيل وتثبيت Aspose.Cells for .NET.

  1. افتح Microsoft Visual Studio ومدير حزم NuGet.
  2. ابحث عن “aspose.cells” للعثور على Aspose.Cells for .NET المطلوبة.
  3. انقر فوق “تثبيت”، سيتم تنزيل Aspose.Cells for .NET والإشارة إليها في مشروعك. ثبت Aspose Cells عبر NuGet

يمكنك أيضًا تنزيله من صفحة الويب nuget ل aspose.cells: حزمة NuGet Aspose.Cells for .NET

المزيد من التفاصيل

ثبت Aspose.Cells على نظام التشغيل Windows

  1. قم بتنزيل Aspose.Cells.msi من الصفحة التالية: تنزيل Aspose.Cells.msi
  2. انقر نقرًا مزدوجًا على Aspose Cells msi واتبع التعليمات لتثبيته:

تثبيت Aspose Cells على نظام التشغيل Windows

المزيد من التفاصيل

تثبيت Aspose.Cells على نظام التشغيل لينكس

في هذا المثال، استخدم Ubuntu لأظهر كيفية البدء باستخدام Aspose.Cells على نظام التشغيل لينكس.

  1. قم بإنشاء تطبيق .netcore، وسمه “AsposeCellsTest”.
  2. افتح ملف “AsposeCellsTest.csproj”، وأضف الأسطر التالية إليه للإشارة إلى حزمة Aspose.Cells:
      <ItemGroup>
        <PackageReference Include="Aspose.Cells" Version="24.7" />
      </ItemGroup>
  3. افتح المشروع باستخدام VSCode على Ubuntu: تثبيت Aspose Cells على نظام التشغيل لينكس
  4. قم بتشغيل الاختبار باستخدام الكود التالي:
    // For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
    Aspose.Cells.Workbook wb1 = new Aspose.Cells.Workbook();
    wb1.Worksheets.Add("linux");
    wb1.Worksheets["linux"].Cells[0, 0].Value = "Using Aspose Cells on linux with VS Code.";
    wb1.Save("linux.xlsx");

ملاحظة: Aspose.Cells لـ .NetStandard يمكن أن تدعم متطلباتك على نظام التشغيل لينكس.

ينطبق على: NetStandard2.0، NetCore2.1، NetCore3.1، Net5.0، Net6.0 والإصدار المتقدم.

تثبيت Aspose.Cells على نظام التشغيل macOS

في هذا المثال، استخدم macOS High Sierra لأظهر كيفية البدء باستخدام Aspose.Cells على نظام التشغيل macOS.

  1. قم بإنشاء تطبيق .netcore، وسمه “AsposeCellsTest”.
  2. افتح التطبيق باستخدام Visual Studio for Mac، ثم قم بتثبيت Aspose Cells من خلال NuGet: تثبيت Aspose Cells على نظام التشغيل macOS
  3. قم بتشغيل الاختبار باستخدام الكود التالي:
    // For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
    Aspose.Cells.Workbook wb1 = new Aspose.Cells.Workbook();
    wb1.Worksheets.Add("macOS");
    wb1.Worksheets["macOS"].Cells[0, 0].Value = "Using Aspose Cells on macOS with Visual Studio For MAC.";
    wb1.Save("macOS.xlsx");
  4. إذا كنت بحاجة إلى استخدام ميزات تتعلق بالرسومات، يرجى تثبيت libgdiplus في نظام التشغيل macOS، انظر: كيفية تثبيت libgdiplus في نظام التشغيل macOS

ملاحظة: Aspose.Cells لـ .NetStandard يمكن أن تدعم متطلباتك على نظام التشغيل macOS.

ينطبق على: NetStandard2.0، NetCore2.1، NetCore3.1، Net5.0، Net6.0 والإصدار المتقدم.

Run Aspose Cells in Docker

كيفية استخدام مكتبة الرسومات على منصات غير ويندوز مع Net6

يستخدم Aspose.Cells for Net6 الآن SkiaSharp كمكتبة الرسومات، كما هو موصى به في بيان رسمي من مايكروسوفت. لمزيد من التفاصيل حول استخدام Aspose.Cells مع NET6، يرجى الاطلاع على كيفية تشغيل Aspose.Cells لـ .Net6.

إنشاء تطبيق مرحبًا بالعالم

تقوم الخطوات التالية بإنشاء تطبيق مرحبًا بالعالم باستخدام واجهة برمجة التطبيقات لـ Aspose.Cells:

  1. إذا كان لديك ترخيص، ثم قم بتطبيقه. إذا كنت تستخدم النسخة التجريبية، فتخطى خطوط الكود المتعلقة بالترخيص.
  2. إنشاء مثيل من فئة Workbook لإنشاء ملف إكسل جديد، أو فتح ملف إكسل موجود. ١. الوصول إلى أي خلية مرغوبة في ورقة العمل في ملف إكسل.
  3. إدراج كلمات Hello World! في الخلية التي تم الوصول إليها.
  4. إنشاء ملف Microsoft Excel المعدل.

يتم توضيح تنفيذ الخطوات أعلاه في الأمثلة أدناه.

مثال على الشفرة: إنشاء مصنف جديد

يُنشئ المثال التالي مصنفًا جديدًا من البداية، يدرج “مرحبا بالعالم!” في الخلية A1 في الصفحة العمل الأولى، ويحفظ كملف Excel.

// 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
{
// Create a License object
License license = new License();
// Set the license of Aspose.Cells to avoid the evaluation limitations
license.SetLicense(dataDir + "Aspose.Cells.lic");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
// Instantiate a Workbook object that represents Excel file.
Workbook wb = new Workbook();
// When you create a new workbook, a default "Sheet1" is added to the workbook.
Worksheet sheet = wb.Worksheets[0];
// Access the "A1" cell in the sheet.
Cell cell = sheet.Cells["A1"];
// Input the "Hello World!" text into the "A1" cell
cell.PutValue("Hello World!");
// Save the Excel file.
wb.Save(dataDir + "MyBook_out.xlsx");

مثال على الشفرة: فتح ملف موجود

يُفتح المثال التالي ملف قالب Microsoft Excel موجود “Sample.xlsx”، يدرج “مرحبا بالعالم!” في الخلية A1 في الصفحة العمل الأولى، ويحفظ كملف Excel.

// 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
{
// Create a License object
License license = new License();
// Set the license of Aspose.Cells to avoid the evaluation limitations
license.SetLicense("Aspose.Cells.lic");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
// Creating a file stream containing the Excel file to be opened
FileStream fstream = new FileStream(dataDir + "Sample.xlsx", FileMode.Open);
// Instantiate a Workbook object that represents the existing Excel file
Workbook workbook = new Workbook(fstream);
// Get the reference of "A1" cell from the cells collection of a worksheet
Cell cell = workbook.Worksheets[0].Cells["A1"];
// Put the "Hello World!" text into the "A1" cell
cell.PutValue("Hello World!");
// Save the Excel file
workbook.Save(dataDir + "HelloWorld_out.xlsx");
// Closing the file stream to free all resources
fstream.Close();