Class Comment

Class Comment

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

セルコメントを表すオブジェクトをカプセル化します。

public class Comment

継承

objectComment

継承メンバー

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

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

//セル A1 にコメントを追加
int commentIndex1 = comments.Add(0, 0);
Comment comment1 = comments[commentIndex1];
comment1.Note = "最初のノート。";
comment1.Font.Name = "Times New Roman";

//セル B2 にコメントを追加
comments.Add("B2");
Comment comment2 = comments["B2"];
comment2.Note = "2 番目のノート。";

//ビジネスを行う

//Excelファイルを保存する。
workbook.Save("exmaple.xlsx");
Dim workbook as Workbook = new Workbook()
Dim comments as CommentCollection = workbook.Worksheets(0).Comments

'セル A1 にコメントを追加
Dim commentIndex1 as Integer = comments.Add(0, 0)
Dim comment1 as Comment = comments(commentIndex1)
comment1.Note = "最初のノート。"
comment1.Font.Name = "Times New Roman"

'セル B2 にコメントを追加
comments.Add("B2")
Dim comment2 As Comment = comments("B2")
comment2.Note = "2 番目のノート。"

プロパティ

Author

元のコメントの作成者の名前を取得および設定します。

public string Author { get; set; }

プロパティ値

string

comment1.Author = "Carl.Yang";

AutoSize

コメントのサイズがその内容に応じて自動的に調整されるかどうかを示します。

public bool AutoSize { get; set; }

プロパティ値

bool

if(!comment1.AutoSize)
{
    //コメントのサイズは内容に応じて変わります
    comment1.AutoSize = true;
}

Column

コメントの列インデックスを取得します。

public int Column { get; }

プロパティ値

int

int column = comment1.Column;

CommentShape

指定されたコメントに添付された形状を表す Shape オブジェクトを取得します。

public CommentShape CommentShape { get; }

プロパティ値

CommentShape

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

Font

コメントのフォントを取得します。

public Font Font { get; }

プロパティ値

Font

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

Height

コメントの高さをピクセル単位で表します。

public int Height { get; set; }

プロパティ値

int

comment1.Height = 10;

HeightCM

コメントの高さをセンチメートル単位で表します。

public double HeightCM { get; set; }

プロパティ値

double

comment1.HeightCM = 1.0;

HeightInch

コメントの高さをインチ単位で表します。

public double HeightInch { get; set; }

プロパティ値

double

comment1.HeightInch = 1.0;

HtmlNote

このコメントにデータといくつかのフォーマットを含む HTML 文字列を取得および設定します。

public string HtmlNote { get; set; }

プロパティ値

string

comment1.HtmlNote = "<Font Style='FONT-FAMILY: Calibri;FONT-SIZE: 11pt;COLOR: #0000ff;TEXT-ALIGN: left;'>これは <b>テスト</b>です。</Font>";

備考

これはスレッドコメントである場合、ノートは変更できません。そうでない場合、MS Excel はそれをスレッドコメントとして処理できません。

IsThreadedComment

このコメントがスレッドコメントであるかどうかを示します。

public bool IsThreadedComment { get; }

プロパティ値

bool

if(comment1.IsThreadedComment)
{
    //このコメントはスレッドコメントです。
}

IsVisible

コメントが表示されているかどうかを表します。

public bool IsVisible { get; set; }

プロパティ値

bool

if(comment1.IsVisible)
{
    //コメントが表示されています
}

Note

コメントの内容を表します。

public string Note { get; set; }

プロパティ値

string

comment1.Note = "最初のノート。";

備考

これはスレッドコメントである場合、ノートは変更できません。そうでない場合、MS Excel はそれをスレッドコメントとして処理できません。

Row

コメントの行インデックスを取得します。

public int Row { get; }

プロパティ値

int

int row = comment1.Row;

TextHorizontalAlignment

コメントのテキストの水平方向の配置タイプを取得および設定します。

public TextAlignmentType TextHorizontalAlignment { get; set; }

プロパティ値

TextAlignmentType

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

TextOrientationType

コメントのテキストの向きタイプを取得および設定します。

public TextOrientationType TextOrientationType { get; set; }

プロパティ値

TextOrientationType

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

TextVerticalAlignment

コメントのテキストの垂直方向の配置タイプを取得および設定します。

public TextAlignmentType TextVerticalAlignment { get; set; }

プロパティ値

TextAlignmentType

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

ThreadedComments

スレッドコメントのリストを取得します。

public ThreadedCommentCollection ThreadedComments { get; }

プロパティ値

ThreadedCommentCollection

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

Width

コメントの幅をピクセル単位で表します。

public int Width { get; set; }

プロパティ値

int

comment1.Width = 10;

WidthCM

コメントの幅をセンチメートル単位で表します。

public double WidthCM { get; set; }

プロパティ値

double

comment1.WidthCM = 1.0;

WidthInch

コメントの幅をインチ単位で表します。

public double WidthInch { get; set; }

プロパティ値

double

comment1.WidthInch = 1.0;

メソッド

Characters(int, int)

コメントテキスト内の文字の範囲を表す Characters オブジェクトを返します。

public FontSetting Characters(int startIndex, int length)

パラメータ

startIndex int

文字の開始インデックス。

length int

文字数。

戻り値

FontSetting

Characters オブジェクト。

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

FormatCharacters(int, int, Font, StyleFlag)

フォント設定でいくつかの文字をフォーマットします。

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

パラメータ

startIndex int

開始インデックス。

length int

長さ。

font Font

フォント設定。

flag StyleFlag

フォント設定のフラグ。

GetRichFormattings()

コメントテキスト内の文字の範囲を表すすべての Characters オブジェクトを返します。

public FontSetting[] GetRichFormattings()

戻り値

FontSetting[]

すべての Characters オブジェクト。

FontSetting[] list = comment1.GetRichFormattings();
 日本語