Class Comment
Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)
셀 주석을 나타내는 객체를 캡슐화합니다.
public class Comment
상속
상속된 멤버
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 = "두 번째 메모.";
// 비즈니스 로직 수행
// 엑셀 파일 저장.
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 = "두 번째 메모."
속성
Author
원래 주석 작성자의 이름을 가져오거나 설정합니다.
public string Author { get; set; }
속성 값
예제
comment1.Author = "Carl.Yang";
AutoSize
주석의 크기가 내용에 따라 자동으로 조정되는지 여부를 나타냅니다.
public bool AutoSize { get; set; }
속성 값
예제
if(!comment1.AutoSize)
{
// 주석의 크기는 내용에 따라 다릅니다.
comment1.AutoSize = true;
}
Column
주석의 열 인덱스를 가져옵니다.
public int Column { get; }
속성 값
예제
int column = comment1.Column;
CommentShape
지정된 주석에 연결된 모양을 나타내는 Shape 객체를 가져옵니다.
public CommentShape CommentShape { get; }
속성 값
예제
CommentShape shape = comment1.CommentShape;
int w = shape.Width;
int h = shape.Height;
Font
주석의 글꼴을 가져옵니다.
public Font Font { get; }
속성 값
예제
Aspose.Cells.Font font = comment1.Font;
font.Size = 12;
Height
주석의 높이를 픽셀 단위로 나타냅니다.
public int Height { get; set; }
속성 값
예제
comment1.Height = 10;
HeightCM
주석의 높이를 센티미터 단위로 나타냅니다.
public double HeightCM { get; set; }
속성 값
예제
comment1.HeightCM = 1.0;
HeightInch
주석의 높이를 인치 단위로 나타냅니다.
public double HeightInch { get; set; }
속성 값
예제
comment1.HeightInch = 1.0;
HtmlNote
이 주석에 데이터와 일부 형식을 포함하는 HTML 문자열을 가져오거나 설정합니다.
public string HtmlNote { get; set; }
속성 값
예제
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; }
속성 값
예제
if(comment1.IsThreadedComment)
{
// 이 주석은 스레드 주석입니다.
}
IsVisible
주석이 보이는지 여부를 나타냅니다.
public bool IsVisible { get; set; }
속성 값
예제
if(comment1.IsVisible)
{
// 주석이 보입니다.
}
Note
주석의 내용을 나타냅니다.
public string Note { get; set; }
속성 값
예제
comment1.Note = "첫 번째 메모.";
비고
이것이 스레드 주석인 경우, 메모를 변경할 수 없으며, 그렇지 않으면 MS Excel이 이를 스레드 주석으로 처리할 수 없습니다.
Row
주석의 행 인덱스를 가져옵니다.
public int Row { get; }
속성 값
예제
int row = comment1.Row;
TextHorizontalAlignment
주석의 텍스트 수평 정렬 유형을 가져오거나 설정합니다.
public TextAlignmentType TextHorizontalAlignment { get; set; }
속성 값
예제
if (comment1.TextHorizontalAlignment == TextAlignmentType.Fill)
{
comment1.TextHorizontalAlignment = TextAlignmentType.Center;
}
TextOrientationType
주석의 텍스트 방향 유형을 가져오거나 설정합니다.
public TextOrientationType TextOrientationType { get; set; }
속성 값
예제
if(comment1.TextOrientationType == TextOrientationType.NoRotation)
{
comment1.TextOrientationType = TextOrientationType.TopToBottom;
}
TextVerticalAlignment
주석의 텍스트 수직 정렬 유형을 가져오거나 설정합니다.
public TextAlignmentType TextVerticalAlignment { get; set; }
속성 값
예제
if (comment1.TextVerticalAlignment == TextAlignmentType.Fill)
{
comment1.TextVerticalAlignment = TextAlignmentType.Center;
}
ThreadedComments
스레드 주석의 목록을 가져옵니다;
public ThreadedCommentCollection ThreadedComments { get; }
속성 값
예제
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; }
속성 값
예제
comment1.Width = 10;
WidthCM
주석의 너비를 센티미터 단위로 나타냅니다.
public double WidthCM { get; set; }
속성 값
예제
comment1.WidthCM = 1.0;
WidthInch
주석의 너비를 인치 단위로 나타냅니다.
public double WidthInch { get; set; }
속성 값
예제
comment1.WidthInch = 1.0;
메서드
Characters(int, int)
주석 텍스트 내의 문자 범위를 나타내는 Characters 객체를 반환합니다.
public FontSetting Characters(int startIndex, int length)
매개변수
startIndex
int
문자의 시작 인덱스입니다.
length
int
문자의 수입니다.
반환
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()
반환
모든 Characters 객체입니다.
예제
FontSetting[] list = comment1.GetRichFormattings();