API العام التغييرات في Aspose.Cells 8.7.0

تمت إضافة واجهات برمجة التطبيقات

دعم التوقيع الرقمي والكشف والاستخراج لمشروع VBA

كشف هذا الإصدار من Aspose.Cells for .NET عن بعض الخصائص والطرق الجديدة لمساعدة المستخدمين في مهام مثل التوقيع رقميًا على مشروع VBA ، واكتشاف ما إذا كان مشروع VBA موقّعًا وصالحًا. علاوة على ذلك ، يسمح API الجديد باستخراج الشهادة كبيانات أولية من مشروع VBA الموقع رقميًا في Workbook.

توقيع مشروع VBA رقميًا

كشف Aspose.Cells for .NET 8.7.0 عن طريقة VbaProject.Sign التي يمكن استخدامهاالتوقيع رقميًا على مشروع VBA في مصنف. تقبل الطريقة المذكورة مثيلًا لفئة التوقيع الرقمي الموجود في مساحة الاسم Aspose.Cells.DigitalSignatures.

فيما يلي سيناريو الاستخدام البسيط.

C#

 //Create an instance of Workbook

//Optionally load an existing spreadsheet

var book = new Workbook();

//Access the VbaProject from the Workbook

var vbaProject = book.VbaProject;

//Sign the VbaProject using the X509Certificate

vbaProject.Sign(new DigitalSignature(new System.Security.Cryptography.X509Certificates.X509Certificate2(cert), "Comments", DateTime.Now));
الكشف عن مشروع VBA الموقع رقميًا

يمكن استخدام الخاصية VbaProject.IsSigned المكشوفة حديثًا في ملفاتاكتشاف ما إذا كان مشروع VBA في مصنف تم توقيعه رقميًا. الخاصية VbaProject.IsSigned هي من النوع Boolean ، والتي ترجع صحيحًا إذا تم توقيع مشروع VBA رقميًا والعكس صحيح.

فيما يلي سيناريو الاستخدام البسيط.

C#

 //Create an instance of Workbook and load an existing spreadsheet

var book = new Workbook(inFilePath);

//Access the VbaProject from the Workbook

var vbaProject = book.VbaProject;

//Check if VbaProject is digitally signed

if (vbaProject.IsSigned)

{

    Console.WriteLine("VbaProject is digitally signed");

}

else

{

    Console.WriteLine("VbaProject is not digitally signed");

}
استخراج التوقيع الرقمي من مشروع VBA

كشفت هذه المراجعة لـ API أيضًا عن خاصية VbaProject.CertRawData التي تسمحاستخراج البيانات الأولية للشهادة الرقمية من مشروع VBA. الخاصية VbaProject.CertRawData هي من نوع صفيف بايت ، والتي ستحتوي على بيانات الشهادة الأولية إذا كان مشروع VBA موقعًا رقميًا ، وإلا ستكون الخاصية المذكورة فارغة.

فيما يلي سيناريو الاستخدام البسيط.

C#

 //Create an instance of Workbook and load an existing spreadsheet

var book = new Workbook(inFilePath);

//Access the VbaProject from the Workbook

var vbaProject = book.VbaProject;

//Extract digital signature in an array of bytes

var cert = vbaProject.CertRawData;
تحقق من صحة التوقيع الرقمي لمشروع VBA

إضافة أخرى إلى API العام هي خاصية VbaProject.IsValidSigned التي يمكن أن تكون مفيدة فيالتحقق من صحة التوقيع الرقمي لمشروع VBA. تعود الخاصية المذكورة صحيحة إذا كان التوقيع الرقمي صحيحًا وخطأ إذا كان التوقيع غير صالح.

فيما يلي سيناريو الاستخدام البسيط.

C#

 //Create an instance of Workbook and load an existing spreadsheet

var book = new Workbook(inFilePath);

//Access the VbaProject from the Workbook

var vbaProject = book.VbaProject;

//Check if VbaProject is digitally signed

if (vbaProject.IsSigned)

{

    //Check if signature is valid

    if (vbaProject.IsValidSigned)

    {

        Console.WriteLine("VbaProject is digitally signed & signature is valid");

    }

}

حماية الطريقة

كشف Aspose.Cells for .NET 8.7.0 عن طريقة الحماية. VerifyPassword التي يمكن استخدامهاتحقق من كلمة المرور المستخدمة لحماية ورقة العمليقبل هذا الأسلوب مثيلاً من السلسلة كمعامل ويعيد صحيحًا إذا تطابق كلمة المرور المحددة مع كلمة المرور المستخدمة لحماية ورقة العمل.

فيما يلي سيناريو الاستخدام البسيط.

C#

 //Create an instance of Workbook and load an existing spreadsheet

var book = new Workbook(inFilePath);

//Access the desired Worksheet via its index or name

var sheet = book.Worksheets[0];

//Access Protection module of desired Worksheet

var protection = sheet.Protection;

//Verify the password for Worksheet

if (protection.VerifyPassword(password))

{

    Console.WriteLine("Password has matched");

}

else

{

    Console.WriteLine("Password did not match");

}

حماية الملكية. حماية مع كلمة المرور المضافة

كشف هذا الإصدار من Aspose.Cells for .NET API أيضًا عن خاصية Protection.IsProtectedWithPassword التي يمكن أن تكون مفيدة فيالكشف عما إذا كانت ورقة العمل محمية بكلمة مرور أم لا.

فيما يلي سيناريو الاستخدام البسيط.

C#

 //Create an instance of Workbook and load an existing spreadsheet

var book = new Workbook(inFilePath);

//Access the desired Worksheet via its index or name

var sheet = book.Worksheets[0];

//Access Protection module of desired Worksheet

var protection = sheet.Protection;

//Check if Worksheet is password protected

if (protection.IsProtectedWithPassword)

{

    Console.WriteLine("Worksheet is password protected");

}

else

{

    Console.WriteLine("Worksheet is not password protected");

}

تمت إضافة خاصية ColorScale.Is3ColorScale

كشف Aspose.Cells for .NET 8.7.0 الخاصية ColorScale.Is3ColorScale التي يمكن استخدامها لإنشاء نسق شرطي لمقياس اللون 2. الخاصية المذكورة هي من النوع Boolean مع القيمة الافتراضية لـ true مما يعني أن التنسيق الشرطي سيكون من 3-Color Scale افتراضيًا. ومع ذلك ، تبديل الخاصية ColorScale.Is3ColorScale إلى false willإنشاء تنسيق شرطي 2-Color Scale.

فيما يلي سيناريو الاستخدام البسيط.

C#

 //Create an instance of Workbook

//Optionally load an existing spreadsheet

var book = new Workbook();

//Access the Worksheet to which conditional formatting rule has to be added

var sheet = book.Worksheets[0];

//Add FormatConditions to the collection

int index = sheet.ConditionalFormattings.Add();

//Access newly added formatConditionCollection via its index

var formatConditionCollection = sheet.ConditionalFormattings[index];

//Create a CellArea on which conditional formatting rule will be applied

var cellArea = CellArea.CreateCellArea("A1", "A5");

//Add conditional formatted cell range

formatConditionCollection.AddArea(cellArea);

//Add format condition of type ColorScale

index = formatConditionCollection.AddCondition(FormatConditionType.ColorScale);

//Access newly added format condition via its index

var formatCondition = formatConditionCollection[index];

//Set Is3ColorScale to false in order to generate a 2-Color Scale format

formatCondition.ColorScale.Is3ColorScale = false;

//Set other necessary properties

تمت إضافة الخاصية TxtLoadOptions.HasFormula

Aspose.Cells for .NET 8.7.0 قدم دعمًا لـتحديد الصيغ وتحليلها أثناء تحميل CSV/TXT الملفات ذات البيانات العادية المحددة. تعرض خاصية TxtLoadOptions.HasFormula المكشوفة حديثًا عند ضبطها على true توجه API لتحليل الصيغ من ملف الإدخال المحدد وتعيينها على الخلايا ذات الصلة دون الحاجة إلى أي معالجة إضافية.

فيما يلي سيناريو الاستخدام البسيط.

C#

 //Create an instance of TxtLoadOptions

var options = new TxtLoadOptions();

//Set HasFormula property to true

options.HasFormula = true;

//Set the Separator property as desired

options.Separator = ',';

//Load the CSV/TXT file using the instance of TxtLoadOptions

var book = new Workbook(inFilePath, options);

//Calculate formulas in order to get the calculated values of formula in CSV

book.CalculateFormula();

//Write result in any of the supported formats

book.Save(outFilePath);

تمت إضافة خاصية DataLabels.IsResizeShapeToFitText

ميزة مفيدة أخرى كشفها Aspose.Cells for .NET 8.7.0 هي خاصية DataLabels.IsResizeShapeToFitText التي يمكنها تمكينتغيير حجم الشكل لاحتواء النصميزة تطبيق Excel لتسميات بيانات الرسم البياني.

فيما يلي سيناريو الاستخدام البسيط.

C#

 //Create an instance of Workbook containing the Chart

var book = new Workbook(inFilePath);

//Access the Worksheet that contains the Chart

var sheet = book.Worksheets[0];

//Access the desired Chart via its index or name

var chart = sheet.Charts[0];

//Access the DataLabels of desired NSeries

var labels = chart.NSeries[0].DataLabels;

//Set ResizeShapeToFitText property to true

labels.IsResizeShapeToFitText = true;

//Calculate Chart

chart.Calculate();

تمت إضافة خاصية PdfSaveOptions.OptimizationType

كشف Aspose.Cells for .NET 8.7.0 خاصية PdfSaveOptions.OptimizationType جنبًا إلى جنب مع تعداد PdfOptimizationType من أجل تسهيل قيام المستخدميناختر خوارزمية التحسين المطلوبة أثناء تصدير جداول البيانات إلى تنسيق PDF. هناك قيمتان محتملتان لخاصية PdfSaveOptions.OptimizationType كما هو مفصل أدناه.

  1. PdfOptimizationType.MinimumSize: يتم اختراق الجودة لحجم الملف الناتج.
  2. PdfOptimizationType.Standard: الجودة غير معرضة للخطر لذا سيكون حجم الملف الناتج كبيرًا.

فيما يلي سيناريو الاستخدام البسيط.

C#

 //Create an instance of PdfSaveOptions

var pdfSaveOptions = new PdfSaveOptions();

//Set the OptimizationType property to desired value

pdfSaveOptions.OptimizationType = PdfOptimizationType.MinimumSize;

//Create an instance of Workbook

//Optionally load an existing spreadsheet

var book = new Workbook(inFilePath);

//Save the spreadsheet in PDF format while passing the instance of PdfSaveOptions

book.Save(outFilePath, pdfSaveOptions);

إزالة واجهات برمجة التطبيقات

مصنف الخاصية تمت إزالة خيارات الحفظ

تم وضع علامة على الخاصية Workbook.SaveOptions قديمة بعض الوقت. مع هذا الإصدار ، تمت إزالته تمامًا من API العام ، لذلك يُنصح باستخدام Workbook.Save (Stream ، SaveOptions) أو Workbook.Save (string ، SaveOptions) كبديل.