إدارة سلاسل HTML للخلايا

سيناريوهات الاستخدام المحتملة

عندما تحتاج إلى تعيين بيانات مهيأة للخلية المحددة، يمكنك تعيين سلسلة HTML للخلية. بالطبع، يمكنك أيضًا الحصول على سلسلة HTML للخلية. تقدم Aspose.Cells هذه الميزة. توفر Aspose.Cells الخصائص والطرق التالية لمساعدتك في تحقيق أهدافك.

الحصول على سلسلة html وتعيينها باستخدام Aspose.Cells

يوضح هذا المثال كيف:

  1. إنشاء دفتر عمل وإضافة بعض البيانات.
  2. الحصول على خلية محددة في الجدول الداخلي الأول.
  3. تعيين سلسلة HTML للخلية.
  4. الحصول على سلسلة HTML للخلية.
//Instantiating an Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the newly added worksheet
Worksheet ws = workbook.Worksheets[0];
Cells cells = ws.Cells;
//Setting the value to the cells
Cell cell = cells["A1"];
cell.PutValue("Fruit");
cell = cells["B1"];
cell.PutValue("Count");
cell = cells["C1"];
cell.PutValue("Price");
cell = cells["A2"];
cell.PutValue("Apple");
cell = cells["A3"];
cell.PutValue("Mango");
cell = cells["A4"];
cell.PutValue("Blackberry");
cell = cells["A5"];
cell.PutValue("Cherry");
Cell c3 = cells["C3"];
//set html string for C3 cell.
c3.HtmlString = "<b>test bold</b>";
Cell c4 = cells["C4"];
//set html string for C4 cell.
c4.HtmlString = "<i>test italic</i>";
//get the html string of specific cell.
Console.WriteLine(c3.HtmlString);
Console.WriteLine(c4.HtmlString);

الإخراج الذي تم توليده بواسطة رمز العينة

تُظهر اللقطة الشاشية التالية الإخراج الناتج من الكود المثالي السابق.

todo:image_alt_text