-
Notifications
You must be signed in to change notification settings - Fork 295
Adding a comment
Jan Källman edited this page Jan 27, 2020
·
10 revisions
You can add comment either by the ExcelRange class or via the Comment Property of the ExcelWorksheet class. Comments can be added using plain text or using richtext as descibed in this example taken from Sample 20-.NET Framework or sample 6-.NET Core...
//Add Comments using the range class
var comment = ws.Cells["A3"].AddComment("Jan Källman:\r\n", "JK");
comment.Font.Bold = true;
var rt = comment.RichText.Add("This column contains the extensions.");
rt.Bold = false;
comment.AutoFit = true;
//Add a comment using the Comment collection
comment = ws.Comments.Add(ws.Cells["B3"],"This column contains the size of the files.", "JK");
//This sets the size and position. (The position is only when the comment is visible)
comment.From.Column = 7;
comment.From.Row = 3;
comment.To.Column = 16;
comment.To.Row = 8;
comment.BackgroundColor = Color.White;
comment.RichText.Add("\r\nTo format the numbers use the Numberformat-property like:\r\n");
EPPlus Software AB - https://epplussoftware.com
- What is new in EPPlus 5+
- Breaking Changes in EPPlus 5
- Breaking Changes in EPPlus 6
- Breaking Changes in EPPlus 7
- Breaking Changes in EPPlus 8
- Addressing a worksheet
- Dimension/Used range
- Copying ranges/sheets
- Insert/Delete
- Filling ranges
- Sorting ranges
- Taking and skipping columns/rows
- Data validation
- Comments
- Freeze and Split Panes
- Header and Footer
- Hyperlinks
- Autofit columns
- Grouping and Ungrouping Rows and Columns
- Formatting and styling
- The ExcelRange.Text property
- Conditional formatting
- Using Themes
- Working with custom named table- or slicer- styles