Public API Changements dans Aspose.Cells 8.8.3

API ajoutées

Prise en charge des contrôles ActiveX

Aspose.Cells for .NET 8.8.3 a exposé la méthode AddActiveXControl qui permet d’ajouter un contrôle ActiveX à la ShapeCollection. La méthode susmentionnée nécessite 7 paramètres pour spécifier le type de contrôle, l’emplacement pour placer le contrôle et la taille du contrôle. Le type peut être spécifié à l’aide de l’énumération ControlType avec les valeurs possibles suivantes.

  1. ControlType.CheckBoxControlType.CheckBox
  2. ControlType.ComboBoxControlType.ComboBox
  3. ControlType.CommandButtonControlType.CommandButtonControlType.CommandButtonControlType.CommandButton
  4. ControlType.Image
  5. ControlType.LabelControlType.Label
  6. ControlType.ListBoxControlType.ListBox
  7. ControlType.RadioButtonControlType.RadioButtonControlType.RadioButtonControlType.RadioButton
  8. ControlType.ScrollBarControlType.ScrollBar
  9. ControlType.SpinButtonControlType.SpinButtonControlType.SpinButtonControlType.SpinButtonControlType.SpinButtonControlType.SpinButtonControlType.SpinButton
  10. ControlType.TextBox
  11. ControlType.ToggleButtonControlType.ToggleButtonControlType.ToggleButton
  12. ControlType.UnknownControlType.Unknown

Voici le scénario d’utilisation simple.

C#

 // Create an instance of Workbook

var book = new Workbook();

// Access first worksheet from the collection

var sheet = book.Worksheets[0];

// Add Toggle Button ActiveX Control to the ShapeCollection at specified location

var shape = sheet.Shapes.AddActiveXControl(ControlType.ToggleButton, 4, 0, 4, 0, 100, 30);

// Access the ActiveX Control object and set its linked cell property

ActiveXControl control = shape.ActiveXControl;

control.LinkedCell = "A1";

// Save the result on disc

book.Save(dir + "output.xlsx", SaveFormat.Xlsx);

Ajout de la méthode LoadOptions.SetPaperSize

Aspose.Cells for .NET 8.8.3 permet de définir le format de papier d’impression par défaut à partir du paramètre par défaut de l’imprimante tout en utilisant la méthode LoadOptions.SetPaperSize nouvellement exposée, comme illustré ci-dessous. Veuillez noter que le paramètre d’entrée de la méthode susmentionnée est la valeur de l’énumération PaperSizeType contenant les formats de papier prédéfinis.

Voici le scénario d’utilisation simple.

C#

 // Create an instance of LoadOptions

var loadOptions = new LoadOptions();

// Set the PaperSize property to appropriate value

loadOptions.SetPaperSize(PaperSizeType.PaperA4);

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

var book = new Workbook(dir + "input.xlsx", loadOptions);

Ajout de la méthode Cell.GetCharacters(flag)

Les API Aspose.Cells permettent d’obtenir les objets caractères sous forme de tableau FontSetting en utilisant la méthode Cell.GetCharacters. Avec cette version, le Aspose.Cells for .NET API a exposé une version surchargée du Cell.GetCharacters qui pourrait accepter Boolean comme paramètre, indiquant si le style de tableau doit être appliqué sur la cellule si la cellule fait partie d’un ListObject.

C#

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

var book = new Workbook(dir + "input.xlsx");

// Access first worksheet from the collection

var sheet = book.Worksheets[0];

// Access cells collection of the first worksheet

var cells = sheet.Cells;

// Access particular cell from a ListObject

// Assuming A1 resides in a ListObject

var cell = cells["A1"];

// Get all Characters objects from the cell

var characters = cell.GetCharacters(true);

Ajout de la propriété OleObject.AutoLoad

Aspose.Cells for .NET 8.8.3 a exposé la propriété OleObject.AutoLoad qui permet de rafraîchir l’image de l’OleObject si le contenu/les données de l’objet sous-jacent ont été modifiés. La propriété susmentionnée, lorsqu’elle est définie sur true, force l’application Excel à actualiser l’image de l’OleObject lorsque la feuille de calcul résultante est chargée.

Voici le scénario d’utilisation simple.

C#

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

var book = new Workbook(dir + "input.xlsx");

// Access first worksheet from the collection

var sheet = book.Worksheets[0];

// Access OleObjectCollection from first worksheet

var oleObjects = sheet.OleObjects;

// Access a OleObject from the collection

var oleObject = oleObjects[0];

// Set AutoLoad to true

oleObject.AutoLoad = true;

Ajout de la propriété HTMLLoadOptions.SupportDivTag

Aspose.Cells for .NET 8.8.3 a exposé la propriété HTMLLoadOptions.SupportDivTag qui permet d’analyser les balises DIV intégrées dans les balises TD lors du chargement des fichiers/extraits HTML dans le modèle d’objet Aspose.Cells. La propriété de type booléen a la valeur par défaut de false.

Voici le scénario d’utilisation simple.

C#

 // Store the HTML snippet in a variable

var export_html = @"

<html>

<body>

    <table>

        <tr>

            <td>

                <div>This is some Text.</div>

                <div>

                    <div>

                        <span>This is some more Text</span>

                    </div>

                    <div>

                        <span>abc@abc.com</span>

                    </div>

                    <div>

                        <span>1234567890</span>

                    </div>

                    <div>

                        <span>ABC DEF</span>

                    </div>

                </div>

                <div>Generated On May 30, 2016 02:33 PM <br />Time Call Received from Jan 01, 2016 to May 30, 2016</div>

            </td>

            <td>

                <img src='ASpose_logo_100x100.png' />

            </td>

        </tr>

    </table>

</body>

</html>";

// Create an instance of MemoryStream and load the contents of the HTML

using (var stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(export_html)))

{

    // Create an instance of HTMLLoadOptions

    var loadOptions = new HTMLLoadOptions(LoadFormat.Html);

    // Set SupportDivTag property to true

    loadOptions.SupportDivTag = true;

    // Create workbook object from the HTML using load options

    var book = new Workbook(stream, loadOptions);

    // Auto fit rows and columns of first worksheet

    var sheet = book.Worksheets[0];

    sheet.AutoFitRows();

    sheet.AutoFitColumns();

    // Save the spreadsheet on disc

    book.Save(dir + "output.xlsx", SaveFormat.Xlsx);

}

Ajout de la propriété HtmlSaveOptions.ExportGridLines

Aspose.Cells for .NET 8.8.3 a exposé la propriété HtmlSaveOptions.ExportGridLines qui permet de restituer les lignes de la grille lors de l’exportation de la feuille de calcul au format HTML. La propriété de type booléen a la valeur par défaut de false, cependant, lorsqu’elle est définie sur true, le API restitue les lignes de grille pour la plage de données disponible au format HTML.

Voici le scénario d’utilisation simple.

C#

 // Create an instance of Workbook and load existing spreadsheet

var book = new Workbook(dir + "input.xlsx");

// Create an instance of HtmlSaveOptions

var options = new HtmlSaveOptions();

// Set ExportGridLines to true

options.ExportGridLines = true;

// Save the result in HTML format

book.Save(dir + "output.html", options);

Ajout de la propriété ListObject.Comment

Aspose.Cells Les API permettent désormais d’obtenir et de définir les commentaires d’une instance de ListObject. Afin de fournir la fonctionnalité susmentionnée, les API Aspose.Cells ont exposé la propriété ListObject.Comment.

Voici le scénario d’utilisation simple.

C#

 // Create an instance of Workbook and load existing spreadsheet

var book = new Workbook(dir + "input.xlsx");

// Access first worksheet from the collection

var sheet = book.Worksheets[0];

// Access first ListObject from the collection of ListObjects

var listObject = sheet.ListObjects[0];

// Set comments for the ListObject

listObject.Comment = "Comments";

// Save the result on disc

book.Save(dir + "output.xlsx");

Ajout de la propriété GridWeb.SessionStorePath

Aspose.Cells.GridWeb for .NET 8.8.3 a exposé la propriété SessionStorePath qui permet d’obtenir ou de définir le chemin du magasin de session lorsque le mode de session est ViewState. La propriété susmentionnée obtient ou définit le chemin relatif vers le répertoire de base de l’application Web actuelle.

Voici le scénario d’utilisation simple.

API supprimées

Suppression de la méthode Workbook.Decrypt

Ladite propriété a été marquée obsolète il y a quelque temps. Cette version l’a complètement supprimé du public API. Il est conseillé de définir la propriété WorkbookSettings.Password sur null afin d’atteindre le même objectif.