Public API Changements dans Aspose.Cells 8.6.1

API ajoutées

Prise en charge du type de cible de lien HTML

Cette version de Aspose.Cells for .NET API a exposé une énumération à savoir HtmlLinkTargetType avec une nouvelle propriété HtmlSaveOptions.LinkTargetType qui, ensemble, permet dedéfinir le type de cible pour les liens dans la feuille de calcul lors de la conversion au format HTML. Les valeurs possibles de l’énumération HtmlLinkTargetType sont les suivantes, où la valeur par défaut est Self.

  1. HtmlLinkTargetType.Blank : ouvre le document/la page liés dans une nouvelle fenêtre ou un nouvel onglet.
  2. HtmlLinkTargetType.Parent : ouvre le document/la page liés dans le cadre parent.
  3. HtmlLinkTargetType.Self : Ouvre le document/la page lié(e) dans le même cadre où le lien a été cliqué.
  4. HtmlLinkTargetType.Top : Ouvre le document/la page lié(e) dans le corps entier de la fenêtre.

Voici le scénario d’utilisation simple.

C#

 //Load a spreadsheet

Workbook workbook = new Workbook(inputFilePath);

//Create an instance of HtmlSaveOptions

HtmlSaveOptions options = new HtmlSaveOptions();

//Set the LinkTargetType property to appropriate value

options.LinkTargetType = HtmlLinkTargetType.Blank;

//Convert the spreadsheet to HTML with preset HtmlSaveOptions

workbook.Save(outputFilePath, options);

Méthode VbaModuleCollection.Remove ajoutée

Aspose.Cells for .NET 8.6.1 a exposé une autre surcharge de la méthode VbaModuleCollection.Remove qui peut désormais accepter une instance de Worksheet pour supprimer tous les modules VBA associés à la Worksheet spécifiée.

Voici le scénario d’utilisation simple.

C#

 //Load a spreadsheet

Workbook workbook = new Workbook(inputFilePath);

//Retrieve the VBA modules from the Workbook

VbaModuleCollection modules = workbook.VbaProject.Modules;

//Remove the VBA modules from specific Worksheet

modules.Remove(workbook.Worksheets[0]);

Méthode RangeCollection.Add Ajouté

Aspose.Cells for .NET 8.6.1 a exposé la méthode RangeCollection.Add qui peut être utilisée pour ajouter des objets Range à la collection de plages pour une feuille de calcul particulière.

Voici le scénario d’utilisation simple.

C#

 //Load a spreadsheet

Workbook workbook = new Workbook(inputFilePath);

//Retrieve the Cells of the first worksheet in the workbook

Cells cells = workbook.Worksheets[0].Cells;

//Retrieve the range collection from first worksheet of the Workbook

RangeCollection ranges = cells.Ranges;

//Add another range to the collection

ranges.Add(cells.CreateRange("A1:B4"));

Méthode Cell.SetCharacters ajouté

La méthode Cell.SetCharacters peut être utilisée pourmettre à jour les parties du texte enrichi d’un objet Cell donné. La méthode Cell.GetCharacters doit être utilisée pour accéder aux parties du texte, puis les modifications peuvent être effectuées à l’aide de la méthode Cell.SetCharacters alors que laObtenir La méthode renvoie un tableau d’objets FontSetting qui peuvent être manipulés pour définir diverses propriétés nom de police, couleur de police, gras, etc. etEnsemble peut être utilisée pour appliquer les modifications.

Voici le scénario d’utilisation simple.

C#

 //Load a spreadsheet

Workbook workbook = new Workbook(inputFilePath);

//Access first worksheet of the workbook

Worksheet worksheet = workbook.Worksheets[0];

//Access the cells containing the Rich Text

Cell cell = worksheet.Cells["A1"];

//Retrieve the array of FontSetting from the cell

FontSetting[]settings = cell.GetCharacters();

//Modify the Font Name for the first FontSetting 

settings[0].Font.Name = "Arial";

//Set the updated FontSetting

cell.SetCharacters(settings);

Propriété VbaProject.IsSigned ajoutée

Aspose.Cells for .NET 8.6.1 a exposé la propriété VbaProject.IsSigned qui peut être utilisée pourtester si un VbaProject dans un classeur est signé ou nonLa propriété de type booléen renvoie true si le projet est signé.

Voici le scénario d’utilisation simple.

C#

 //Load a spreadsheet

Workbook workbook = new Workbook(inputFilePath);

//Retrieve the VbaProject from the Workbook

VbaProject project = workbook.VbaProject;

//Test if VbaProject is signed

if (project.IsSigned)

{

    Console.WriteLine("VBA Project is Signed");

}

else

{

    Console.WriteLine("VBA Project is not Signed");

}

API modifiées

Méthode Cell.GetFormatConditions modifiées

Avec la version v8.6.1, le Aspose.Cells for .NET API a modifié le type de retour de la méthode Cell.GetFormatConditions qui renvoie désormais un tableau de type FormatConditionCollection.

API obsolètes

Méthode Workbook.CheckWriteProtectedPassword obsolète

Avec la version v8.6.1, la méthode Workbook.CheckWriteProtectedPassword a été marquée comme dépréciée. Il est conseillé d’utiliser la méthode WorkbookSettings.WriteProtection.ValidatePassword qui peut accepter une valeur de chaîne comme paramètre et renvoie un booléen si le mot de passe correspond au mot de passe prédéfini de la feuille de calcul.