How to Create, Move, Show, Hide & Remove Comment in Excel Cell using EPPlus (C#) [Hindi]-PART 8
Автор: Everyday Be Coding
Загружено: 2017-06-01
Просмотров: 177
Описание:
EPPLUS Library - Beginners Guide Part-8
-------------------------------------------------------------------------
How to Add, Move, Hide & Remove Comments to an Excel Worksheet Cell using EPPlus?
-------------------------------------------------------------------------
English Video link : • How to Create, Move, Show, Hide & Remove C...
-------------------------------------------------------------------------
Blog : https://everyday-be-coding.blogspot.c...
-----------------------------------------------------------------------
Twitter : / everydaycoding
-----------------------------------------------------------------------
Facebook: / everydaybecoding
---------------------------------------------------------------------------------
Source code download link : https://goo.gl/E2R9ru
---------------------------------------------------------------------------------
What is Comments?
------------------------------------
Comments are basically notes that can be inserted into any cell in Excel. It’s very useful for reminders & notes for others subject.
When a cell has a comment, a red indicator appears in the corner of the cell, when your mouse pointer hover on the cell, the comment appears.
What do you want to do with Comments using EPPlus?
-----------------------------------------------------------------------------------------
Add a comment.
Move a comment box.
Display or hide comments and their indicators.
Delete a comment.
Format a comment. (We will be discuss on this topic in Part-9 of this video series)
How to Add a Comment on Excel using EPPlus ?
-------------------------------------------------------------------------------
There are two ways to create Comments in excel sheet.
Option 1 - Using AddComment() method of ExcelRange class.
Option 2 - Using Add() method of ExcelCommentCollection class and it assign to the Comments property of ExcelWorksheet class.
Option 1 : Using AddComment() method of ExcelRange class.
---------------------------------------------------------------------------------------------------
ExcelRange Rng = wsSheet1.Cells["B5"];
Rng.Value = "Everyday Be Coding";
ExcelComment cmd = Rng.AddComment("Comment Text", "Rajdip");
Above example we can see AddComment() method of ExcelRange class accept two things as parameter, First string Text and Second string Author & It assign by ExcelComment class object cmd . Here ExcelComment class can control this comments behavior.
Option 2 : Using Add() method of ExcelCommentCollection class.
---------------------------------------------------------------------------------------------------------
ExcelRange Rng = wsSheet1.Cells["B10"];
Rng.Value = "https://everyday-be-coding.blogspot.in/";
ExcelComment cmd = wsSheet1.Comments.Add(Rng, "Comment Text", "Rajdip");
Above example we can see Add() method of ExcelCommentCollection class accept three things as parameter, First is object of ExcelRange class & second is string Text & third is string Author. It assign by ExcelComment class object cmd. Here ExcelComment class can control this comments behavior.
Move Comments Box in Excel Sheet :
------------------------------------------------------------
ExcelRange Rng = wsSheet1.Cells["B5"]
Rng.Value = "Everyday Be Coding";
ExcelComment cmd = Rng.AddComment("Comment Text", "Rajdip");
cmd.From.Column = 1; //Zero Index base
cmd.To.Column = 2;
cmd.From.Row = 12;
cmd.To.Row = 14;
Class ExcelComment object is cmd. This class is inherited form ExcelVmlDrawingComment class & it has two property From & To. Class ExcelComment access From & To property from base class. These From, To properties are type of ExcelVmlDrawingPosition class & ExcelVmlDrawingPosition class has two integer type property Column & Row. We are assign it to specific row and column for moving comment box in excel worksheet.
*Note: assign the integer value of row and columns are zero index based.
Display and Hide Comments and their Indicators :
--------------------------------------------------------------------------------
ExcelRange Rng = wsSheet1.Cells["B5"];
Rng.Value = "Everyday Be Coding";
ExcelComment cmd = Rng.AddComment("Comment Text", "Rajdip");
cmd.Visible = true;
ExcelComment has Visible property, It accept bool value for comment is display or not.
Delete Comments in Excel Sheet:
------------------------------------------------------
ExcelRange Rng = wsSheet1.Cells["B10"];
ExcelComment cmd = wsSheet1.Cells["B10"].Comment;
wsSheet1.Comments.Remove(cmd);
ExcelWorkSheet class has a property Comments & It has a Remove() method. This method accept ExcelComment object as a parameter for delete the comment in excel sheet.
Thank you for watching this video.
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: