Class Comment

Class Comment

Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)

Incapsula l’oggetto che rappresenta un commento di cella.

public class Comment

Ereditarietà

objectComment

Membri Ereditati

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Esempi

Workbook workbook = new Workbook();
CommentCollection comments = workbook.Worksheets[0].Comments;

//Aggiungi commento alla cella A1
int commentIndex1 = comments.Add(0, 0);
Comment comment1 = comments[commentIndex1];
comment1.Note = "Prima nota.";
comment1.Font.Name = "Times New Roman";

//Aggiungi commento alla cella B2
comments.Add("B2");
Comment comment2 = comments["B2"];
comment2.Note = "Seconda nota.";

//esegui la tua operazione

//Salva il file excel.
workbook.Save("exmaple.xlsx");
Dim workbook as Workbook = new Workbook()
Dim comments as CommentCollection = workbook.Worksheets(0).Comments

'Aggiungi commento alla cella A1
Dim commentIndex1 as Integer = comments.Add(0, 0)
Dim comment1 as Comment = comments(commentIndex1)
comment1.Note = "Prima nota."
comment1.Font.Name = "Times New Roman"

'Aggiungi commento alla cella B2
comments.Add("B2")
Dim comment2 As Comment = comments("B2")
comment2.Note = "Seconda nota."

Proprietà

Autore

Ottiene e imposta il nome dell’autore originale del commento.

public string Author { get; set; }

Valore della Proprietà

string

Esempi

comment1.Author = "Carl.Yang";

AutoSize

Indica se la dimensione del commento viene regolata automaticamente in base al suo contenuto.

public bool AutoSize { get; set; }

Valore della Proprietà

bool

Esempi

if(!comment1.AutoSize)
{
    //La dimensione del commento varia con il contenuto
    comment1.AutoSize = true;
}

Colonna

Ottiene l’indice della colonna del commento.

public int Column { get; }

Valore della Proprietà

int

Esempi

int column = comment1.Column;

CommentShape

Ottiene un oggetto Shape che rappresenta la forma allegata al commento specificato.

public CommentShape CommentShape { get; }

Valore della Proprietà

CommentShape

Esempi

CommentShape shape = comment1.CommentShape;
int w = shape.Width;
int h = shape.Height;

Font

Ottiene il font del commento.

public Font Font { get; }

Valore della Proprietà

Font

Esempi

Aspose.Cells.Font font = comment1.Font;
font.Size = 12;

Altezza

Rappresenta l’altezza del commento, in unità di pixel.

public int Height { get; set; }

Valore della Proprietà

int

Esempi

comment1.Height = 10;

AltezzaCM

Rappresenta l’altezza del commento, in unità di centimetri.

public double HeightCM { get; set; }

Valore della Proprietà

double

Esempi

comment1.HeightCM = 1.0;

AltezzaPollice

Rappresenta l’altezza del commento, in unità di pollici.

public double HeightInch { get; set; }

Valore della Proprietà

double

Esempi

comment1.HeightInch = 1.0;

HtmlNote

Ottiene e imposta la stringa html che contiene dati e alcuni formati in questo commento.

public string HtmlNote { get; set; }

Valore della Proprietà

string

Esempi

comment1.HtmlNote = "<Font Style='FONT-FAMILY: Calibri;FONT-SIZE: 11pt;COLOR: #0000ff;TEXT-ALIGN: left;'>Questo è un <b>test</b>.</Font>";

Osservazioni

Se questo è un commento a thread, la nota non potrebbe essere cambiata, altrimenti MS Excel non potrebbe elaborarlo come un commento a thread.

IsThreadedComment

Indica se questo commento è un commento a thread.

public bool IsThreadedComment { get; }

Valore della Proprietà

bool

Esempi

if(comment1.IsThreadedComment)
{
    //Questo commento è un commento a thread.
}

IsVisible

Rappresenta se il commento è visibile o meno.

public bool IsVisible { get; set; }

Valore della Proprietà

bool

Esempi

if(comment1.IsVisible)
{
    //Il commento è visibile
}

Nota

Rappresenta il contenuto del commento.

public string Note { get; set; }

Valore della Proprietà

string

Esempi

comment1.Note = "Prima nota.";

Osservazioni

Se questo è un commento a thread, la nota non potrebbe essere cambiata, altrimenti MS Excel non potrebbe elaborarlo come un commento a thread.

Riga

Ottiene l’indice della riga del commento.

public int Row { get; }

Valore della Proprietà

int

Esempi

int row = comment1.Row;

TextHorizontalAlignment

Ottiene e imposta il tipo di allineamento orizzontale del testo del commento.

public TextAlignmentType TextHorizontalAlignment { get; set; }

Valore della Proprietà

TextAlignmentType

Esempi

if (comment1.TextHorizontalAlignment ==  TextAlignmentType.Fill)
{
    comment1.TextHorizontalAlignment = TextAlignmentType.Center;
}

TextOrientationType

Ottiene e imposta il tipo di orientamento del testo del commento.

public TextOrientationType TextOrientationType { get; set; }

Valore della Proprietà

TextOrientationType

Esempi

if(comment1.TextOrientationType == TextOrientationType.NoRotation)
{
    comment1.TextOrientationType = TextOrientationType.TopToBottom;
}

TextVerticalAlignment

Ottiene e imposta il tipo di allineamento verticale del testo del commento.

public TextAlignmentType TextVerticalAlignment { get; set; }

Valore della Proprietà

TextAlignmentType

Esempi

if (comment1.TextVerticalAlignment ==  TextAlignmentType.Fill)
{
    comment1.TextVerticalAlignment = TextAlignmentType.Center;
}

ThreadedComments

Ottiene l’elenco dei commenti a thread;

public ThreadedCommentCollection ThreadedComments { get; }

Valore della Proprietà

ThreadedCommentCollection

Esempi

ThreadedCommentCollection threadedComments = comment1.ThreadedComments;
for (int i = 0; i < threadedComments.Count; ++i)
{
    ThreadedComment tc = threadedComments[i];
    string note = tc.Notes;
}

Larghezza

Rappresenta la larghezza del commento, in unità di pixel.

public int Width { get; set; }

Valore della Proprietà

int

Esempi

comment1.Width = 10;

WidthCM

Rappresenta la larghezza del commento, in unità di centimetri.

public double WidthCM { get; set; }

Valore della Proprietà

double

Esempi

comment1.WidthCM = 1.0;

WidthInch

Rappresenta la larghezza del commento, in unità di pollici.

public double WidthInch { get; set; }

Valore della Proprietà

double

Esempi

comment1.WidthInch = 1.0;

Metodi

Characters(int, int)

Restituisce un oggetto Characters che rappresenta un intervallo di caratteri all’interno del testo del commento.

public FontSetting Characters(int startIndex, int length)

Parametri

startIndex int

L’indice dell’inizio del carattere.

length int

Il numero di caratteri.

Restituisce

FontSetting

Oggetto Characters.

Esempi

Aspose.Cells.FontSetting fontSetting = comment1.Characters(0, 4);

FormatCharacters(int, int, Font, StyleFlag)

Formatta alcuni caratteri con le impostazioni del font.

public void FormatCharacters(int startIndex, int length, Font font, StyleFlag flag)

Parametri

startIndex int

L’indice di inizio.

length int

La lunghezza.

font Font

Le impostazioni del font.

flag StyleFlag

Il flag delle impostazioni del font.

GetRichFormattings()

Restituisce tutti gli oggetti Characters che rappresentano un intervallo di caratteri all’interno del testo del commento.

public FontSetting[] GetRichFormattings()

Restituisce

FontSetting[]

Tutti gli oggetti Characters

Esempi

FontSetting[] list = comment1.GetRichFormattings();
 Italiano