using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace iDiTect.Excel.Demo
{
    public static class CommentHelper
    {
        public static void AddCommentToSheet()
        {
            var workbook = new Workbook();
            var worksheet = workbook.Worksheets.Add("CommentSheet");

            //Add simple comment
            worksheet.Cell("A1").Comment.AddText("Single line comment.");
            
            //Add multiple lines comment
            var comment = worksheet.Cell("A2").Comment;
            comment.AddText("Frist line in comment.").SetBold().SetFontSize(6);
            comment.AddNewLine();
            comment.AddText("Sencond line.").FontName = "Times New Roman";

            //Add auto fit width comment
            comment = worksheet.Cell("A3").Comment;
            comment.AddText("This is a very very very very very long line comment1.");
            comment.Style.Size.AutomaticSize = true;

            //Add target size comment
            comment = worksheet.Cell("A4").Comment;
            comment.AddText("This is a very very very very very long line comment2.");
            comment.Style.Size.Height = 100;
            comment.Style.Size.Width = 10;            

            //Add target position comment
            comment = worksheet.Cell("A5").Comment;
            comment.AddText("This comment will be shown on E5.");
            comment.Position.Column = 5;
            comment.Position.Row = 5;
            //The position is available only when the comment is visible.
            comment.Visible = true;

            //Add colorful comment
            comment = worksheet.Cell("A6").Comment;
            comment.AddText("This").FontColor = ExcelColor.Red;
            comment.AddText(" is").FontColor = ExcelColor.FromArgb(0, 0, 128, 0);
            comment.AddText(" colorful").FontColor = ExcelColor.FromHtml("#987654");
            comment.AddText(" line.").FontColor = ExcelColor.Black;

            workbook.Save("comment.xlsx");
        }



    }
}
