diff --git a/comments-and-notes/add-a-threaded-comment-with-multi-line-text-to-cell-h2-and-preserve-line-breaks.cs b/comments-and-notes/add-a-threaded-comment-with-multi-line-text-to-cell-h2-and-preserve-line-breaks.cs
new file mode 100644
index 000000000..bd644c010
--- /dev/null
+++ b/comments-and-notes/add-a-threaded-comment-with-multi-line-text-to-cell-h2-and-preserve-line-breaks.cs
@@ -0,0 +1,31 @@
+using System;
+using Aspose.Cells;
+
+namespace AsposeCellsThreadedCommentExample
+{
+ class Program
+ {
+ static void Main()
+ {
+ // Create a new workbook
+ Workbook workbook = new Workbook();
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Add a threaded comment author
+ int authorIndex = worksheet.Workbook.Worksheets.ThreadedCommentAuthors.Add(
+ "Demo Author", // Author name
+ "demo.author@example.com", // User ID (email)
+ "DEMO_PROVIDER"); // Provider ID
+ ThreadedCommentAuthor author = worksheet.Workbook.Worksheets.ThreadedCommentAuthors[authorIndex];
+
+ // Multi-line comment text (preserves line breaks)
+ string commentText = "First line of comment.\nSecond line of comment.\nThird line of comment.";
+
+ // Add a threaded comment to cell H2 (row index 1, column index 7)
+ worksheet.Comments.AddThreadedComment(1, 7, commentText, author);
+
+ // Save the workbook
+ workbook.Save("ThreadedComment_H2.xlsx");
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/agents.md b/comments-and-notes/agents.md
new file mode 100644
index 000000000..dc1d4ef4c
--- /dev/null
+++ b/comments-and-notes/agents.md
@@ -0,0 +1,81 @@
+# Comments and Notes Examples
+
+This folder contains **Aspose.Cells for .NET** code examples related to:
+
+Comments and Notes
+
+
+## Purpose
+
+These examples demonstrate common **Aspose.Cells APIs** used when working with:
+
+- Workbooks
+- Worksheets
+- Cells
+- Formulas
+- Charts
+- Data operations
+
+
+## Example Files
+
+Each `.cs` file demonstrates a specific task related to **Comments and Notes**.
+
+Example:
+
+create-a-workbook.cs
+
+
+## Required Namespaces
+
+Most examples will require:
+
+using Aspose.Cells;
+
+
+## Common Pattern
+
+Typical Aspose.Cells workflow:
+
+Workbook workbook = new Workbook();
+
+Worksheet sheet = workbook.Worksheets[0];
+
+Cells cells = sheet.Cells;
+
+
+## Output
+
+Examples may generate:
+
+- XLSX files
+- PDF files
+- CSV files
+- Images
+
+Output files are written to the working directory.
+- create-a-new-workbook-and-add-a-threaded-comment-to-cell-a1-with-author-john.cs
+- load-an-existing-workbook-retrieve-all-threaded-comments-from-column-b-and-list-their-authors.cs
+- iterate-through-a-threadedcommentcollection-to-display-each-comments-text-author-and-creation-timestamp.cs
+- edit-a-specific-threaded-comment-by-setting-its-text-property-to-a-new-string-value.cs
+- remove-a-threaded-comment-from-cell-c3-using-the-remove-method-on-the-comment-object.cs
+- set-the-text-direction-of-a-comments-shape-to-righttoleft-for-bidirectional-language-support.cs
+- set-the-text-direction-of-a-comments-shape-to-toptobottom-for-vertical-annotation-layout.cs
+- change-the-font-color-of-a-comment-by-assigning-a-red-value-to-shapetextbodyfontcolor.cs
+- update-the-font-color-of-all-comments-authored-by-alice-to-green-using-shapetextbodyfontcolor.cs
+- apply-a-solid-blue-background-to-a-comment-using-shapefillforecolor-with-the-appropriate-color-code.cs
+- create-a-workbook-add-threaded-comments-to-multiple-cells-and-save-the-file-in-xlsx-format.cs
+- load-a-workbook-modify-comment-font-colors-based-on-author-and-save-changes-to-a-new-file.cs
+- batch-process-a-folder-of-workbooks-adding-a-standard-disclaimer-comment-to-each-worksheets-top-left-cell.cs
+- copy-a-threaded-comment-from-cell-e5-to-cell-f6-while-preserving-its-author-and-text.cs
+- read-all-threaded-comments-from-a-worksheet-and-count-the-number-of-comments-per-author.cs
+- remove-all-comments-older-than-thirty-days-from-a-workbook-based-on-their-createdtime-values.cs
+- scan-a-workbook-for-empty-comments-and-remove-them-to-clean-metadata.cs
+- compare-two-workbooks-by-extracting-their-threaded-comments-and-identifying-differences-in-author-attribution.cs
+- read-the-author-of-each-threaded-comment-in-a-worksheet-and-output-the-list.cs
+- change-the-font-color-of-comments-in-column-g-to-blue-using-shapetextbodyfontcolor.cs
+- add-a-threaded-comment-with-multi-line-text-to-cell-h2-and-preserve-line-breaks.cs
+- retrieve-and-display-the-total-number-of-threaded-comments-present-in-a-workbook.cs
+- update-the-text-direction-of-all-comments-in-a-worksheet-to-lefttoright-for-standard-layout.cs
+- replace-the-background-picture-of-a-comment-with-a-semi-transparent-overlay-image.cs
+- copy-formatting-of-a-comments-shape-including-background-color-and-font-color-to-another-comment.cs
diff --git a/comments-and-notes/apply-a-solid-blue-background-to-a-comment-using-shapefillforecolor-with-the-appropriate-color-code.cs b/comments-and-notes/apply-a-solid-blue-background-to-a-comment-using-shapefillforecolor-with-the-appropriate-color-code.cs
new file mode 100644
index 000000000..9abf3e6c1
--- /dev/null
+++ b/comments-and-notes/apply-a-solid-blue-background-to-a-comment-using-shapefillforecolor-with-the-appropriate-color-code.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Drawing;
+using Aspose.Cells;
+using Aspose.Cells.Drawing;
+
+class ApplyBlueBackgroundToComment
+{
+ static void Main()
+ {
+ // Create a new workbook and get the first worksheet
+ Workbook workbook = new Workbook();
+ Worksheet sheet = workbook.Worksheets[0];
+
+ // Add a comment to cell A1
+ int commentIndex = sheet.Comments.Add("A1");
+ Comment comment = sheet.Comments[commentIndex];
+ comment.Note = "This is a sample comment";
+
+ // Access the shape associated with the comment
+ Shape commentShape = comment.CommentShape;
+
+ // Make sure the shape's fill is visible
+ commentShape.IsFilled = true;
+
+ // Apply a solid blue background using the FillFormat's ForeColor
+ commentShape.FillFormat.ForeColor = Color.Blue;
+
+ // Save the workbook
+ workbook.Save("CommentBlueBackground.xlsx");
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/batch-process-a-folder-of-workbooks-adding-a-standard-disclaimer-comment-to-each-worksheets-top-left-cell.cs b/comments-and-notes/batch-process-a-folder-of-workbooks-adding-a-standard-disclaimer-comment-to-each-worksheets-top-left-cell.cs
new file mode 100644
index 000000000..570975575
--- /dev/null
+++ b/comments-and-notes/batch-process-a-folder-of-workbooks-adding-a-standard-disclaimer-comment-to-each-worksheets-top-left-cell.cs
@@ -0,0 +1,46 @@
+using System;
+using System.IO;
+using Aspose.Cells;
+
+namespace BatchDisclaimer
+{
+ public static class WorkbookProcessor
+ {
+ // Adds a disclaimer comment to the top‑left cell (A1) of every worksheet in all workbooks
+ // found in the specified folder. The original files are overwritten with the updated version.
+ public static void AddDisclaimerToFolder(string folderPath, string disclaimer)
+ {
+ // Get all Excel files in the folder (you can adjust the pattern if needed)
+ string[] files = Directory.GetFiles(folderPath, "*.xlsx", SearchOption.TopDirectoryOnly);
+
+ foreach (string filePath in files)
+ {
+ // Load the workbook using the constructor that accepts a file path
+ using (Workbook workbook = new Workbook(filePath))
+ {
+ // Iterate through each worksheet in the workbook
+ foreach (Worksheet sheet in workbook.Worksheets)
+ {
+ // Add a comment to cell A1 (top‑left cell)
+ int commentIndex = sheet.Comments.Add("A1");
+ sheet.Comments[commentIndex].Note = disclaimer;
+ }
+
+ // Save the modified workbook back to the same file (overwrite)
+ workbook.Save(filePath);
+ }
+ }
+ }
+
+ // Example usage
+ public static void Main()
+ {
+ string folder = @"C:\ExcelFiles"; // Folder containing the workbooks
+ string disclaimerText = "This workbook is confidential and intended for authorized personnel only.";
+
+ AddDisclaimerToFolder(folder, disclaimerText);
+
+ Console.WriteLine("Disclaimer added to all workbooks in the folder.");
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/change-the-font-color-of-a-comment-by-assigning-a-red-value-to-shapetextbodyfontcolor.cs b/comments-and-notes/change-the-font-color-of-a-comment-by-assigning-a-red-value-to-shapetextbodyfontcolor.cs
new file mode 100644
index 000000000..45ac86953
--- /dev/null
+++ b/comments-and-notes/change-the-font-color-of-a-comment-by-assigning-a-red-value-to-shapetextbodyfontcolor.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Drawing;
+using Aspose.Cells;
+using Aspose.Cells.Drawing;
+
+namespace AsposeCellsCommentFontColor
+{
+ class Program
+ {
+ static void Main()
+ {
+ // Create a new workbook and get the first worksheet
+ Workbook workbook = new Workbook();
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Add a comment to cell A1
+ int commentIndex = worksheet.Comments.Add("A1");
+ Comment comment = worksheet.Comments[commentIndex];
+ comment.Note = "This is a sample comment";
+
+ // Access the shape attached to the comment
+ CommentShape commentShape = comment.CommentShape;
+
+ // Ensure the shape has a TextBody collection
+ // Set the font color of the first text run to red
+ // (FontSettingCollection items expose a Font property)
+ commentShape.TextBody[0].Font.Color = Color.Red;
+
+ // Optionally make the comment visible
+ comment.IsVisible = true;
+
+ // Save the workbook
+ workbook.Save("CommentWithRedFont.xlsx");
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/change-the-font-color-of-comments-in-column-g-to-blue-using-shapetextbodyfontcolor.cs b/comments-and-notes/change-the-font-color-of-comments-in-column-g-to-blue-using-shapetextbodyfontcolor.cs
new file mode 100644
index 000000000..15e9d6346
--- /dev/null
+++ b/comments-and-notes/change-the-font-color-of-comments-in-column-g-to-blue-using-shapetextbodyfontcolor.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Drawing;
+using Aspose.Cells;
+using Aspose.Cells.Drawing;
+
+class ChangeCommentFontColorInColumnG
+{
+ static void Main()
+ {
+ // Create a new workbook and get the first worksheet
+ Workbook workbook = new Workbook();
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Add sample comments in column G (index 6)
+ for (int row = 0; row < 5; row++)
+ {
+ // Add a comment to cell G{row+1}
+ int commentIndex = worksheet.Comments.Add(row, 6);
+ Comment comment = worksheet.Comments[commentIndex];
+ comment.Note = $"Comment at G{row + 1}";
+ }
+
+ // Iterate through all comments and change font color to blue for those in column G
+ foreach (Comment comment in worksheet.Comments)
+ {
+ if (comment.Column == 6) // Column G (zero‑based index)
+ {
+ // Access the shape associated with the comment
+ CommentShape shape = comment.CommentShape;
+
+ // Use the TextBody collection to set the font color.
+ // The TextBody collection contains FontSetting objects; we modify the first (and only) one.
+ // This changes the font color of the entire comment text.
+ shape.TextBody[0].Font.Color = Color.Blue;
+
+ // Ensure the comment is visible (optional)
+ comment.IsVisible = true;
+ }
+ }
+
+ // Save the workbook
+ workbook.Save("CommentsColumnG_BlueFont.xlsx");
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/compare-two-workbooks-by-extracting-their-threaded-comments-and-identifying-differences-in-author-attribution.cs b/comments-and-notes/compare-two-workbooks-by-extracting-their-threaded-comments-and-identifying-differences-in-author-attribution.cs
new file mode 100644
index 000000000..efd2f7785
--- /dev/null
+++ b/comments-and-notes/compare-two-workbooks-by-extracting-their-threaded-comments-and-identifying-differences-in-author-attribution.cs
@@ -0,0 +1,123 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Aspose.Cells;
+
+namespace ThreadedCommentComparison
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ // Paths to the two workbooks to compare
+ string workbookPath1 = "Workbook1.xlsx";
+ string workbookPath2 = "Workbook2.xlsx";
+
+ // Load the workbooks (lifecycle rule: use Workbook constructor)
+ Workbook wb1 = new Workbook(workbookPath1);
+ Workbook wb2 = new Workbook(workbookPath2);
+
+ // Extract threaded comment author information from each workbook
+ var commentsInfo1 = ExtractThreadedComments(wb1);
+ var commentsInfo2 = ExtractThreadedComments(wb2);
+
+ // Compare the extracted information and display differences
+ CompareCommentAuthors(commentsInfo1, commentsInfo2);
+ }
+
+ ///
+ /// Traverses all worksheets, cells and extracts the list of author names for each cell that contains threaded comments.
+ /// The key is a fully qualified cell address in the form "SheetName!A1".
+ ///
+ private static Dictionary> ExtractThreadedComments(Workbook workbook)
+ {
+ var result = new Dictionary>(StringComparer.OrdinalIgnoreCase);
+
+ // Iterate through each worksheet
+ for (int wsIndex = 0; wsIndex < workbook.Worksheets.Count; wsIndex++)
+ {
+ Worksheet sheet = workbook.Worksheets[wsIndex];
+ Cells cells = sheet.Cells;
+
+ // Determine the used range to limit iteration
+ int maxRow = cells.MaxDataRow;
+ int maxCol = cells.MaxDataColumn;
+
+ // Scan each cell within the used range
+ for (int row = 0; row <= maxRow; row++)
+ {
+ for (int col = 0; col <= maxCol; col++)
+ {
+ // Retrieve threaded comments for the current cell
+ ThreadedCommentCollection threadedComments = sheet.Comments.GetThreadedComments(row, col);
+ if (threadedComments != null && threadedComments.Count > 0)
+ {
+ // Build a key like "Sheet1!B2"
+ string cellAddress = cells[row, col].Name; // e.g., "B2"
+ string key = $"{sheet.Name}!{cellAddress}";
+
+ // Collect author names for all threaded comments in this cell
+ var authors = new List();
+ foreach (ThreadedComment tc in threadedComments)
+ {
+ // Guard against null author (should not happen, but be safe)
+ if (tc.Author != null)
+ authors.Add(tc.Author.Name);
+ }
+
+ // Store the list (order is not important for comparison)
+ result[key] = authors;
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ ///
+ /// Compares two dictionaries containing threaded comment author lists and prints differences.
+ ///
+ private static void CompareCommentAuthors(
+ Dictionary> dict1,
+ Dictionary> dict2)
+ {
+ // Union of all keys from both workbooks
+ var allKeys = new HashSet(dict1.Keys, StringComparer.OrdinalIgnoreCase);
+ allKeys.UnionWith(dict2.Keys);
+
+ foreach (var key in allKeys.OrderBy(k => k))
+ {
+ bool inFirst = dict1.TryGetValue(key, out var authors1);
+ bool inSecond = dict2.TryGetValue(key, out var authors2);
+
+ if (!inFirst)
+ {
+ Console.WriteLine($"Cell {key} exists only in Workbook2 with authors: {string.Join(", ", authors2)}");
+ }
+ else if (!inSecond)
+ {
+ Console.WriteLine($"Cell {key} exists only in Workbook1 with authors: {string.Join(", ", authors1)}");
+ }
+ else
+ {
+ // Both workbooks have threaded comments in this cell; compare author sets
+ var set1 = new HashSet(authors1, StringComparer.OrdinalIgnoreCase);
+ var set2 = new HashSet(authors2, StringComparer.OrdinalIgnoreCase);
+
+ if (!set1.SetEquals(set2))
+ {
+ var onlyInFirst = set1.Except(set2);
+ var onlyInSecond = set2.Except(set1);
+
+ Console.WriteLine($"Difference in authors for cell {key}:");
+ if (onlyInFirst.Any())
+ Console.WriteLine($" Only in Workbook1: {string.Join(", ", onlyInFirst)}");
+ if (onlyInSecond.Any())
+ Console.WriteLine($" Only in Workbook2: {string.Join(", ", onlyInSecond)}");
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/copy-a-threaded-comment-from-cell-e5-to-cell-f6-while-preserving-its-author-and-text.cs b/comments-and-notes/copy-a-threaded-comment-from-cell-e5-to-cell-f6-while-preserving-its-author-and-text.cs
new file mode 100644
index 000000000..e39e78a6a
--- /dev/null
+++ b/comments-and-notes/copy-a-threaded-comment-from-cell-e5-to-cell-f6-while-preserving-its-author-and-text.cs
@@ -0,0 +1,48 @@
+using System;
+using Aspose.Cells;
+
+namespace ThreadedCommentCopyDemo
+{
+ class Program
+ {
+ static void Main()
+ {
+ // Create a new workbook (or load an existing one)
+ Workbook workbook = new Workbook();
+ Worksheet worksheet = workbook.Worksheets[0];
+ CommentCollection comments = worksheet.Comments;
+
+ // ------------------------------------------------------------
+ // Ensure there is a threaded comment in cell E5 for demonstration
+ // ------------------------------------------------------------
+ int authorIndex = workbook.Worksheets.ThreadedCommentAuthors.Add(
+ "Demo Author", // Name
+ "demoUser@example.com", // UserId
+ "DemoProvider"); // ProviderId
+
+ ThreadedCommentAuthor author = workbook.Worksheets.ThreadedCommentAuthors[authorIndex];
+
+ // Add a threaded comment to cell E5
+ comments.AddThreadedComment("E5", "Original comment text", author);
+
+ // ------------------------------------------------------------
+ // Retrieve all threaded comments from cell E5
+ // ------------------------------------------------------------
+ ThreadedCommentCollection sourceComments = comments.GetThreadedComments("E5");
+
+ // ------------------------------------------------------------
+ // Copy each threaded comment to cell F6, preserving author and text
+ // ------------------------------------------------------------
+ foreach (ThreadedComment srcComment in sourceComments)
+ {
+ // Add a new threaded comment to F6 with the same notes and author
+ comments.AddThreadedComment("F6", srcComment.Notes, srcComment.Author);
+ }
+
+ // ------------------------------------------------------------
+ // Save the workbook
+ // ------------------------------------------------------------
+ workbook.Save("CopyThreadedComment.xlsx");
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/copy-formatting-of-a-comments-shape-including-background-color-and-font-color-to-another-comment.cs b/comments-and-notes/copy-formatting-of-a-comments-shape-including-background-color-and-font-color-to-another-comment.cs
new file mode 100644
index 000000000..0405f1fa0
--- /dev/null
+++ b/comments-and-notes/copy-formatting-of-a-comments-shape-including-background-color-and-font-color-to-another-comment.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Drawing;
+using Aspose.Cells;
+using Aspose.Cells.Drawing;
+
+namespace AsposeCellsCommentFormattingCopy
+{
+ class Program
+ {
+ static void Main()
+ {
+ // Create a new workbook and get the first worksheet
+ Workbook workbook = new Workbook();
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Access the comments collection of the worksheet
+ CommentCollection comments = worksheet.Comments;
+
+ // -------------------------------------------------
+ // Create source comment (A1) and set its shape format
+ // -------------------------------------------------
+ int srcIndex = comments.Add("A1");
+ Comment srcComment = comments[srcIndex];
+ srcComment.Note = "Source comment";
+
+ // Set background color (fill) of the source comment shape
+ CommentShape srcShape = srcComment.CommentShape;
+ srcShape.Fill.FillType = FillType.Solid;
+ srcShape.Fill.SolidFill.Color = Color.LightYellow; // background color
+
+ // Set font color of the source comment shape
+ srcShape.Font.Color = Color.Blue; // font color
+
+ // -------------------------------------------------
+ // Create destination comment (B2) – formatting will be copied
+ // -------------------------------------------------
+ int destIndex = comments.Add("B2");
+ Comment destComment = comments[destIndex];
+ destComment.Note = "Destination comment";
+
+ // Get the shape of the destination comment
+ CommentShape destShape = destComment.CommentShape;
+
+ // -------------------------------
+ // Copy formatting from source to destination
+ // -------------------------------
+ // Copy background (fill) settings
+ destShape.Fill.FillType = srcShape.Fill.FillType;
+ destShape.Fill.SolidFill.Color = srcShape.Fill.SolidFill.Color;
+
+ // Copy font color
+ destShape.Font.Color = srcShape.Font.Color;
+
+ // Save the workbook to verify the result
+ workbook.Save("CommentFormattingCopy.xlsx");
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/create-a-new-workbook-and-add-a-threaded-comment-to-cell-a1-with-author-john.cs b/comments-and-notes/create-a-new-workbook-and-add-a-threaded-comment-to-cell-a1-with-author-john.cs
new file mode 100644
index 000000000..f42962561
--- /dev/null
+++ b/comments-and-notes/create-a-new-workbook-and-add-a-threaded-comment-to-cell-a1-with-author-john.cs
@@ -0,0 +1,21 @@
+using Aspose.Cells;
+
+class Program
+{
+ static void Main()
+ {
+ // Create a new workbook and get the first worksheet
+ Workbook workbook = new Workbook();
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Add a threaded comment author named John
+ int authorIndex = workbook.Worksheets.ThreadedCommentAuthors.Add("John", "john@example.com", "PROVIDER");
+ ThreadedCommentAuthor johnAuthor = workbook.Worksheets.ThreadedCommentAuthors[authorIndex];
+
+ // Add a threaded comment to cell A1 using the author
+ worksheet.Comments.AddThreadedComment("A1", "This is a threaded comment.", johnAuthor);
+
+ // Save the workbook
+ workbook.Save("ThreadedCommentJohn.xlsx");
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/create-a-workbook-add-threaded-comments-to-multiple-cells-and-save-the-file-in-xlsx-format.cs b/comments-and-notes/create-a-workbook-add-threaded-comments-to-multiple-cells-and-save-the-file-in-xlsx-format.cs
new file mode 100644
index 000000000..8791917f4
--- /dev/null
+++ b/comments-and-notes/create-a-workbook-add-threaded-comments-to-multiple-cells-and-save-the-file-in-xlsx-format.cs
@@ -0,0 +1,33 @@
+using System;
+using Aspose.Cells;
+
+namespace ThreadedCommentDemo
+{
+ class Program
+ {
+ static void Main()
+ {
+ // Create a new workbook
+ Workbook workbook = new Workbook();
+
+ // Get the first worksheet
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Add a threaded comment author
+ ThreadedCommentAuthorCollection authorCollection = workbook.Worksheets.ThreadedCommentAuthors;
+ int authorIndex = authorCollection.Add("John Doe", "john.doe@example.com", "PROVIDER");
+ ThreadedCommentAuthor author = authorCollection[authorIndex];
+
+ // Access the comments collection of the worksheet
+ CommentCollection comments = worksheet.Comments;
+
+ // Add threaded comments to multiple cells
+ comments.AddThreadedComment("A1", "First threaded comment", author);
+ comments.AddThreadedComment("B2", "Second threaded comment", author);
+ comments.AddThreadedComment("C3", "Third threaded comment", author);
+
+ // Save the workbook in XLSX format
+ workbook.Save("ThreadedCommentsDemo.xlsx");
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/edit-a-specific-threaded-comment-by-setting-its-text-property-to-a-new-string-value.cs b/comments-and-notes/edit-a-specific-threaded-comment-by-setting-its-text-property-to-a-new-string-value.cs
new file mode 100644
index 000000000..36012875c
--- /dev/null
+++ b/comments-and-notes/edit-a-specific-threaded-comment-by-setting-its-text-property-to-a-new-string-value.cs
@@ -0,0 +1,53 @@
+using System;
+using System.IO;
+using Aspose.Cells;
+
+class EditThreadedComment
+{
+ static void Main()
+ {
+ try
+ {
+ const string inputPath = "input.xlsx";
+ const string outputPath = "output.xlsx";
+
+ // Verify that the input workbook exists
+ if (!File.Exists(inputPath))
+ {
+ Console.WriteLine($"Input file not found: {inputPath}");
+ return;
+ }
+
+ // Load the workbook
+ Workbook workbook = new Workbook(inputPath);
+
+ // Access the first worksheet
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Cell that contains the threaded comment to edit
+ string targetCell = "A1";
+
+ // Retrieve threaded comments for the cell (may be null if none exist)
+ ThreadedCommentCollection threadedComments = worksheet.Comments.GetThreadedComments(targetCell);
+
+ if (threadedComments != null && threadedComments.Count > 0)
+ {
+ // Edit the first threaded comment
+ ThreadedComment comment = threadedComments[0];
+ comment.Notes = "Updated comment text set via Aspose.Cells.";
+ }
+ else
+ {
+ Console.WriteLine($"No threaded comments found at cell {targetCell}.");
+ }
+
+ // Save the updated workbook
+ workbook.Save(outputPath);
+ Console.WriteLine($"Workbook saved to {outputPath}");
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"An error occurred: {ex.Message}");
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/iterate-through-a-threadedcommentcollection-to-display-each-comments-text-author-and-creation-timestamp.cs b/comments-and-notes/iterate-through-a-threadedcommentcollection-to-display-each-comments-text-author-and-creation-timestamp.cs
new file mode 100644
index 000000000..f8050c10b
--- /dev/null
+++ b/comments-and-notes/iterate-through-a-threadedcommentcollection-to-display-each-comments-text-author-and-creation-timestamp.cs
@@ -0,0 +1,43 @@
+using System;
+using Aspose.Cells;
+
+class ThreadedCommentIterationDemo
+{
+ static void Main()
+ {
+ // Create a new workbook and get the first worksheet
+ Workbook workbook = new Workbook();
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Add a threaded comment author to the workbook
+ int authorIndex = workbook.Worksheets.ThreadedCommentAuthors.Add(
+ "Alice", // Author name
+ "alice@example.com", // User ID / email
+ "Provider1"); // Provider ID
+ ThreadedCommentAuthor author = workbook.Worksheets.ThreadedCommentAuthors[authorIndex];
+
+ // Add a regular comment to cell A1 (required to host threaded comments)
+ int commentIndex = worksheet.Comments.Add("A1");
+ Comment comment = worksheet.Comments[commentIndex];
+
+ // Add threaded comments to the comment
+ comment.ThreadedComments.Add("First threaded comment", author);
+ comment.ThreadedComments.Add("Second threaded comment", author);
+
+ // Retrieve the collection of threaded comments
+ ThreadedCommentCollection threadedComments = comment.ThreadedComments;
+
+ // Iterate through the collection and display each comment's details
+ for (int i = 0; i < threadedComments.Count; i++)
+ {
+ ThreadedComment tc = threadedComments[i];
+ Console.WriteLine($"Comment {i + 1}:");
+ Console.WriteLine($" Text : {tc.Notes}");
+ Console.WriteLine($" Author : {tc.Author.Name}");
+ Console.WriteLine($" Created: {tc.CreatedTime}");
+ }
+
+ // Save the workbook (optional, demonstrates lifecycle usage)
+ workbook.Save("ThreadedCommentsDemo.xlsx");
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/load-a-workbook-modify-comment-font-colors-based-on-author-and-save-changes-to-a-new-file.cs b/comments-and-notes/load-a-workbook-modify-comment-font-colors-based-on-author-and-save-changes-to-a-new-file.cs
new file mode 100644
index 000000000..6bff64845
--- /dev/null
+++ b/comments-and-notes/load-a-workbook-modify-comment-font-colors-based-on-author-and-save-changes-to-a-new-file.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Drawing;
+using Aspose.Cells;
+
+namespace CommentFontColorModifier
+{
+ class Program
+ {
+ static void Main()
+ {
+ // Load the existing workbook
+ Workbook workbook = new Workbook("input.xlsx");
+
+ // Iterate through all worksheets
+ foreach (Worksheet sheet in workbook.Worksheets)
+ {
+ // Access the comments collection of the worksheet
+ CommentCollection comments = sheet.Comments;
+
+ // Loop through each comment in the collection
+ for (int i = 0; i < comments.Count; i++)
+ {
+ Comment comment = comments[i];
+
+ // Determine the font color based on the comment author
+ // Example logic: Red for "Alice", Blue for "Bob", default Black otherwise
+ if (comment.Author != null && comment.Author.Equals("Alice", StringComparison.OrdinalIgnoreCase))
+ {
+ comment.Font.Color = Color.Red;
+ }
+ else if (comment.Author != null && comment.Author.Equals("Bob", StringComparison.OrdinalIgnoreCase))
+ {
+ comment.Font.Color = Color.Blue;
+ }
+ else
+ {
+ comment.Font.Color = Color.Black;
+ }
+ }
+ }
+
+ // Save the modified workbook to a new file
+ workbook.Save("output.xlsx");
+
+ // Clean up
+ workbook.Dispose();
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/load-an-existing-workbook-retrieve-all-threaded-comments-from-column-b-and-list-their-authors.cs b/comments-and-notes/load-an-existing-workbook-retrieve-all-threaded-comments-from-column-b-and-list-their-authors.cs
new file mode 100644
index 000000000..48ef2a637
--- /dev/null
+++ b/comments-and-notes/load-an-existing-workbook-retrieve-all-threaded-comments-from-column-b-and-list-their-authors.cs
@@ -0,0 +1,40 @@
+using System;
+using Aspose.Cells;
+
+class Program
+{
+ static void Main()
+ {
+ // Load the existing workbook
+ Workbook workbook = new Workbook("input.xlsx");
+
+ // Access the first worksheet (adjust index if needed)
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Get the comments collection of the worksheet
+ CommentCollection comments = worksheet.Comments;
+
+ // Determine the last used row in the worksheet to limit the loop
+ int lastRow = worksheet.Cells.MaxDataRow;
+
+ // Column B has index 1 (zero‑based)
+ int columnBIndex = 1;
+
+ // Iterate through each row that may contain a threaded comment in column B
+ for (int row = 0; row <= lastRow; row++)
+ {
+ // Retrieve threaded comments for the cell at (row, column B)
+ ThreadedCommentCollection threadedComments = comments.GetThreadedComments(row, columnBIndex);
+
+ // If there are any threaded comments, list their authors
+ if (threadedComments != null && threadedComments.Count > 0)
+ {
+ foreach (ThreadedComment tc in threadedComments)
+ {
+ // Output the author name of each threaded comment
+ Console.WriteLine($"Cell B{row + 1}: Author = {tc.Author.Name}");
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/read-all-threaded-comments-from-a-worksheet-and-count-the-number-of-comments-per-author.cs b/comments-and-notes/read-all-threaded-comments-from-a-worksheet-and-count-the-number-of-comments-per-author.cs
new file mode 100644
index 000000000..a7536d1de
--- /dev/null
+++ b/comments-and-notes/read-all-threaded-comments-from-a-worksheet-and-count-the-number-of-comments-per-author.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using Aspose.Cells;
+
+class ThreadedCommentAuthorCounter
+{
+ static void Main()
+ {
+ // Load an existing workbook (replace with your file path)
+ Workbook workbook = new Workbook("ThreadedCommentsDemo.xlsx");
+
+ // Access the first worksheet (or any specific worksheet)
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Dictionary to hold comment count per author name
+ Dictionary authorCommentCount = new Dictionary(StringComparer.OrdinalIgnoreCase);
+
+ // Iterate through all comments in the worksheet
+ foreach (Comment comment in worksheet.Comments)
+ {
+ // Each comment may contain a collection of threaded comments
+ ThreadedCommentCollection threadedComments = comment.ThreadedComments;
+
+ // Count each threaded comment by its author
+ foreach (ThreadedComment tc in threadedComments)
+ {
+ string authorName = tc.Author?.Name ?? "Unknown";
+
+ if (authorCommentCount.ContainsKey(authorName))
+ authorCommentCount[authorName]++;
+ else
+ authorCommentCount[authorName] = 1;
+ }
+ }
+
+ // Output the results
+ Console.WriteLine("Threaded comment count per author:");
+ foreach (var kvp in authorCommentCount)
+ {
+ Console.WriteLine($"{kvp.Key}: {kvp.Value}");
+ }
+
+ // Optionally, save the workbook if any modifications were made
+ // workbook.Save("ThreadedCommentsDemo_Output.xlsx");
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/read-the-author-of-each-threaded-comment-in-a-worksheet-and-output-the-list.cs b/comments-and-notes/read-the-author-of-each-threaded-comment-in-a-worksheet-and-output-the-list.cs
new file mode 100644
index 000000000..15b51a78a
--- /dev/null
+++ b/comments-and-notes/read-the-author-of-each-threaded-comment-in-a-worksheet-and-output-the-list.cs
@@ -0,0 +1,53 @@
+using System;
+using Aspose.Cells;
+
+namespace AsposeCellsThreadedCommentAuthors
+{
+ class Program
+ {
+ static void Main()
+ {
+ // Create a new workbook (lifecycle rule)
+ Workbook workbook = new Workbook();
+
+ // Access the first worksheet
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // ------------------------------------------------------------
+ // Prepare sample data: add two authors and some threaded comments
+ // ------------------------------------------------------------
+ ThreadedCommentAuthorCollection authors = workbook.Worksheets.ThreadedCommentAuthors;
+
+ // Add authors to the collection
+ int aliceIndex = authors.Add("Alice", "alice@example.com", "A");
+ int bobIndex = authors.Add("Bob", "bob@example.com", "B");
+
+ // Retrieve author objects
+ ThreadedCommentAuthor alice = authors[aliceIndex];
+ ThreadedCommentAuthor bob = authors[bobIndex];
+
+ // Add a regular comment to cell A1
+ Comment comment = worksheet.Comments[worksheet.Comments.Add("A1")];
+ comment.Note = "Parent comment";
+
+ // Add threaded comments to the comment
+ comment.ThreadedComments.Add("First threaded comment", alice);
+ comment.ThreadedComments.Add("Second threaded comment", bob);
+
+ // ------------------------------------------------------------
+ // Read and output the author of each threaded comment in the worksheet
+ // ------------------------------------------------------------
+ foreach (Comment cmt in worksheet.Comments)
+ {
+ foreach (ThreadedComment tc in cmt.ThreadedComments)
+ {
+ // Output author name
+ Console.WriteLine($"Threaded comment author: {tc.Author.Name}");
+ }
+ }
+
+ // Save the workbook (lifecycle rule)
+ workbook.Save("ThreadedCommentAuthorsOutput.xlsx");
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/remove-a-threaded-comment-from-cell-c3-using-the-remove-method-on-the-comment-object.cs b/comments-and-notes/remove-a-threaded-comment-from-cell-c3-using-the-remove-method-on-the-comment-object.cs
new file mode 100644
index 000000000..44843410e
--- /dev/null
+++ b/comments-and-notes/remove-a-threaded-comment-from-cell-c3-using-the-remove-method-on-the-comment-object.cs
@@ -0,0 +1,28 @@
+using System;
+using Aspose.Cells;
+
+class RemoveThreadedCommentDemo
+{
+ static void Main()
+ {
+ // Create a new workbook and get the first worksheet
+ Workbook workbook = new Workbook();
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Add a threaded comment author
+ int authorIndex = workbook.Worksheets.ThreadedCommentAuthors.Add(
+ "John Doe", // author name
+ "john.doe@example.com", // author email / user id
+ "PROVIDER"); // provider id
+ ThreadedCommentAuthor author = workbook.Worksheets.ThreadedCommentAuthors[authorIndex];
+
+ // Add a threaded comment to cell C3
+ worksheet.Comments.AddThreadedComment("C3", "Initial threaded comment", author);
+
+ // Remove the comment (and its threaded comments) from cell C3
+ worksheet.Comments.RemoveAt("C3");
+
+ // Save the workbook
+ workbook.Save("RemovedThreadedComment.xlsx");
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/remove-all-comments-older-than-thirty-days-from-a-workbook-based-on-their-createdtime-values.cs b/comments-and-notes/remove-all-comments-older-than-thirty-days-from-a-workbook-based-on-their-createdtime-values.cs
new file mode 100644
index 000000000..a58e9c8f7
--- /dev/null
+++ b/comments-and-notes/remove-all-comments-older-than-thirty-days-from-a-workbook-based-on-their-createdtime-values.cs
@@ -0,0 +1,50 @@
+using System;
+using System.IO;
+using Aspose.Cells;
+
+namespace RemoveOldCommentsDemo
+{
+ class Program
+ {
+ static void Main()
+ {
+ const string inputPath = "input.xlsx";
+ const string outputPath = "output.xlsx";
+
+ // Verify that the input file exists to avoid FileNotFoundException
+ if (!File.Exists(inputPath))
+ {
+ Console.WriteLine($"Input file not found: {inputPath}");
+ return;
+ }
+
+ try
+ {
+ // Load the workbook
+ Workbook workbook = new Workbook(inputPath);
+
+ // Iterate through each worksheet in the workbook
+ foreach (Worksheet worksheet in workbook.Worksheets)
+ {
+ CommentCollection comments = worksheet.Comments;
+
+ // Iterate backwards so that removal does not affect the loop index
+ for (int i = comments.Count - 1; i >= 0; i--)
+ {
+ // Remove the comment at the current index
+ comments.RemoveAt(i);
+ }
+ }
+
+ // Save the modified workbook
+ workbook.Save(outputPath, SaveFormat.Xlsx);
+ Console.WriteLine($"Workbook saved successfully to {outputPath}");
+ }
+ catch (Exception ex)
+ {
+ // Handle any runtime errors
+ Console.WriteLine($"An error occurred: {ex.Message}");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/replace-the-background-picture-of-a-comment-with-a-semi-transparent-overlay-image.cs b/comments-and-notes/replace-the-background-picture-of-a-comment-with-a-semi-transparent-overlay-image.cs
new file mode 100644
index 000000000..5f7f279cd
--- /dev/null
+++ b/comments-and-notes/replace-the-background-picture-of-a-comment-with-a-semi-transparent-overlay-image.cs
@@ -0,0 +1,40 @@
+using System;
+using System.IO;
+using Aspose.Cells;
+using Aspose.Cells.Drawing;
+
+class ReplaceCommentBackground
+{
+ static void Main()
+ {
+ try
+ {
+ // Create a new workbook
+ Workbook workbook = new Workbook();
+ Worksheet sheet = workbook.Worksheets[0];
+
+ // Add a comment to cell B2
+ int commentIdx = sheet.Comments.Add("B2");
+ Comment comment = sheet.Comments[commentIdx];
+ comment.Note = "Original comment";
+
+ // Load overlay image if it exists
+ string overlayPath = "overlay.png";
+ if (!File.Exists(overlayPath))
+ throw new FileNotFoundException($"Overlay image not found: {overlayPath}");
+
+ byte[] overlayBytes = File.ReadAllBytes(overlayPath);
+
+ // Set the overlay image as the comment background
+ comment.CommentShape.Fill.ImageData = overlayBytes; // picture fill
+ comment.CommentShape.Fill.Transparency = 0.5; // 50 % transparent
+
+ // Save the workbook
+ workbook.Save("CommentWithOverlay.xlsx");
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Error: {ex.Message}");
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/retrieve-and-display-the-total-number-of-threaded-comments-present-in-a-workbook.cs b/comments-and-notes/retrieve-and-display-the-total-number-of-threaded-comments-present-in-a-workbook.cs
new file mode 100644
index 000000000..0f0fefe98
--- /dev/null
+++ b/comments-and-notes/retrieve-and-display-the-total-number-of-threaded-comments-present-in-a-workbook.cs
@@ -0,0 +1,44 @@
+using System;
+using Aspose.Cells;
+
+namespace AsposeCellsThreadedCommentCount
+{
+ class Program
+ {
+ static void Main()
+ {
+ // Create a new workbook
+ Workbook workbook = new Workbook();
+ Worksheet sheet = workbook.Worksheets[0];
+
+ // Add a threaded comment author
+ int authorIdx = workbook.Worksheets.ThreadedCommentAuthors.Add("John Doe", "john.doe@example.com", "JD");
+ ThreadedCommentAuthor author = workbook.Worksheets.ThreadedCommentAuthors[authorIdx];
+
+ // Add some threaded comments to different cells
+ sheet.Comments.AddThreadedComment("A1", "First comment", author);
+ sheet.Comments.AddThreadedComment("A1", "Reply to first", author);
+ sheet.Comments.AddThreadedComment("B2", "Another comment", author);
+
+ // Variable to hold total count
+ int totalThreadedComments = 0;
+
+ // Iterate through all worksheets
+ foreach (Worksheet ws in workbook.Worksheets)
+ {
+ // Iterate through all comments in the worksheet
+ foreach (Comment comment in ws.Comments)
+ {
+ // Each comment may contain a collection of threaded comments
+ totalThreadedComments += comment.ThreadedComments.Count;
+ }
+ }
+
+ // Display the total number of threaded comments
+ Console.WriteLine($"Total threaded comments in the workbook: {totalThreadedComments}");
+
+ // Save the workbook (optional, just to demonstrate lifecycle usage)
+ workbook.Save("ThreadedCommentsCount.xlsx");
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/scan-a-workbook-for-empty-comments-and-remove-them-to-clean-metadata.cs b/comments-and-notes/scan-a-workbook-for-empty-comments-and-remove-them-to-clean-metadata.cs
new file mode 100644
index 000000000..c24ab10fe
--- /dev/null
+++ b/comments-and-notes/scan-a-workbook-for-empty-comments-and-remove-them-to-clean-metadata.cs
@@ -0,0 +1,57 @@
+using System;
+using System.IO;
+using Aspose.Cells;
+
+namespace AsposeCellsExamples
+{
+ public class RemoveEmptyComments
+ {
+ public static void Main(string[] args)
+ {
+ try
+ {
+ Run();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Error: {ex.Message}");
+ }
+ }
+
+ public static void Run()
+ {
+ string inputPath = "input.xlsx";
+ string outputPath = "output.xlsx";
+
+ // Ensure the input file exists before loading
+ if (!File.Exists(inputPath))
+ {
+ Console.WriteLine($"Input file not found: {inputPath}");
+ return;
+ }
+
+ // Load the workbook
+ Workbook workbook = new Workbook(inputPath);
+
+ // Iterate through all worksheets
+ foreach (Worksheet worksheet in workbook.Worksheets)
+ {
+ // Iterate backwards through comments to safely remove items
+ for (int i = worksheet.Comments.Count - 1; i >= 0; i--)
+ {
+ Comment comment = worksheet.Comments[i];
+
+ // Remove comment if its text is null, empty, or whitespace
+ if (string.IsNullOrWhiteSpace(comment.Note))
+ {
+ worksheet.Comments.RemoveAt(comment.Row, comment.Column);
+ }
+ }
+ }
+
+ // Save the cleaned workbook
+ workbook.Save(outputPath, SaveFormat.Xlsx);
+ Console.WriteLine($"Workbook saved to {outputPath}");
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/set-the-text-direction-of-a-comments-shape-to-righttoleft-for-bidirectional-language-support.cs b/comments-and-notes/set-the-text-direction-of-a-comments-shape-to-righttoleft-for-bidirectional-language-support.cs
new file mode 100644
index 000000000..14498b15d
--- /dev/null
+++ b/comments-and-notes/set-the-text-direction-of-a-comments-shape-to-righttoleft-for-bidirectional-language-support.cs
@@ -0,0 +1,27 @@
+using System;
+using Aspose.Cells;
+using Aspose.Cells.Drawing;
+
+class SetCommentShapeTextDirection
+{
+ static void Main()
+ {
+ // Create a new workbook and get the first worksheet
+ Workbook workbook = new Workbook();
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Add a comment to cell A1
+ int commentIndex = worksheet.Comments.Add("A1");
+ Comment comment = worksheet.Comments[commentIndex];
+ comment.Note = "مثال على النص من اليمين إلى اليسار"; // Sample Arabic text
+
+ // Access the shape associated with the comment
+ CommentShape commentShape = comment.CommentShape;
+
+ // Set the text direction of the comment's shape to RightToLeft
+ commentShape.TextDirection = TextDirectionType.RightToLeft;
+
+ // Save the workbook
+ workbook.Save("CommentShapeRightToLeft.xlsx");
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/set-the-text-direction-of-a-comments-shape-to-toptobottom-for-vertical-annotation-layout.cs b/comments-and-notes/set-the-text-direction-of-a-comments-shape-to-toptobottom-for-vertical-annotation-layout.cs
new file mode 100644
index 000000000..b830f43fd
--- /dev/null
+++ b/comments-and-notes/set-the-text-direction-of-a-comments-shape-to-toptobottom-for-vertical-annotation-layout.cs
@@ -0,0 +1,26 @@
+using System;
+using Aspose.Cells;
+
+namespace AsposeCellsCommentOrientation
+{
+ class Program
+ {
+ static void Main()
+ {
+ // Create a new workbook
+ Workbook workbook = new Workbook();
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Add a comment to cell A1
+ int commentIndex = worksheet.Comments.Add("A1");
+ Comment comment = worksheet.Comments[commentIndex];
+ comment.Note = "This comment will be displayed vertically.";
+
+ // Set the text direction of the comment's shape to TopToBottom
+ comment.TextOrientationType = TextOrientationType.TopToBottom;
+
+ // Save the workbook
+ workbook.Save("CommentTopToBottom.xlsx");
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/update-the-font-color-of-all-comments-authored-by-alice-to-green-using-shapetextbodyfontcolor.cs b/comments-and-notes/update-the-font-color-of-all-comments-authored-by-alice-to-green-using-shapetextbodyfontcolor.cs
new file mode 100644
index 000000000..9be0bc1c1
--- /dev/null
+++ b/comments-and-notes/update-the-font-color-of-all-comments-authored-by-alice-to-green-using-shapetextbodyfontcolor.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Drawing;
+using System.IO;
+using Aspose.Cells;
+using Aspose.Cells.Drawing;
+
+class UpdateCommentFontColor
+{
+ static void Main()
+ {
+ const string inputPath = "input.xlsx";
+ const string outputPath = "output.xlsx";
+
+ try
+ {
+ // Verify that the input workbook exists
+ if (!File.Exists(inputPath))
+ {
+ Console.WriteLine($"Input file not found: {inputPath}");
+ return;
+ }
+
+ // Load the workbook
+ Workbook workbook = new Workbook(inputPath);
+
+ // Iterate through all worksheets
+ foreach (Worksheet sheet in workbook.Worksheets)
+ {
+ // Access the collection of comments on the current worksheet
+ CommentCollection comments = sheet.Comments;
+
+ // Loop through each comment
+ for (int i = 0; i < comments.Count; i++)
+ {
+ Comment comment = comments[i];
+
+ // Check if the comment author is "Alice"
+ if (string.Equals(comment.Author, "Alice", StringComparison.OrdinalIgnoreCase))
+ {
+ // Get the shape associated with the comment
+ Shape commentShape = comment.CommentShape;
+
+ // Set the font color of the comment text to green
+ // For comment shapes the Font property controls the text formatting
+ commentShape.Font.Color = Color.Green;
+ }
+ }
+ }
+
+ // Save the modified workbook
+ workbook.Save(outputPath);
+ Console.WriteLine($"Workbook saved successfully to {outputPath}");
+ }
+ catch (Exception ex)
+ {
+ // Handle any unexpected errors
+ Console.WriteLine($"An error occurred: {ex.Message}");
+ }
+ }
+}
\ No newline at end of file
diff --git a/comments-and-notes/update-the-text-direction-of-all-comments-in-a-worksheet-to-lefttoright-for-standard-layout.cs b/comments-and-notes/update-the-text-direction-of-all-comments-in-a-worksheet-to-lefttoright-for-standard-layout.cs
new file mode 100644
index 000000000..5cd557654
--- /dev/null
+++ b/comments-and-notes/update-the-text-direction-of-all-comments-in-a-worksheet-to-lefttoright-for-standard-layout.cs
@@ -0,0 +1,48 @@
+using System;
+using System.IO;
+using Aspose.Cells;
+
+namespace AsposeCellsDemo
+{
+ class UpdateCommentTextDirection
+ {
+ static void Main()
+ {
+ string inputPath = "input.xlsx";
+ string outputPath = "output.xlsx";
+
+ try
+ {
+ // Verify that the input file exists
+ if (!File.Exists(inputPath))
+ {
+ Console.WriteLine($"Input file not found: {inputPath}");
+ return;
+ }
+
+ // Load the workbook
+ Workbook workbook = new Workbook(inputPath);
+
+ // Access the first worksheet
+ Worksheet worksheet = workbook.Worksheets[0];
+
+ // Update text direction for each comment
+ foreach (Comment comment in worksheet.Comments)
+ {
+ if (comment.CommentShape != null)
+ {
+ comment.CommentShape.TextDirection = TextDirectionType.LeftToRight;
+ }
+ }
+
+ // Save the updated workbook
+ workbook.Save(outputPath);
+ Console.WriteLine($"Workbook saved to {outputPath}");
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"Error: {ex.Message}");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/index.json b/index.json
index fa283587c..bdeb042bc 100644
--- a/index.json
+++ b/index.json
@@ -4,11 +4,131 @@
"language": "csharp",
"framework": ".NET",
"examples": [
+ {
+ "category": "comments-and-notes",
+ "file": "add-a-threaded-comment-with-multi-line-text-to-cell-h2-and-preserve-line-breaks.cs",
+ "title": "Add a threaded comment with multi-line text to cell H2 and preserve line breaks."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "apply-a-solid-blue-background-to-a-comment-using-shapefillforecolor-with-the-appropriate-color-code.cs",
+ "title": "Apply a solid blue background to a comment using Shape.Fill.ForeColor with the appropriate color code."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "batch-process-a-folder-of-workbooks-adding-a-standard-disclaimer-comment-to-each-worksheets-top-left-cell.cs",
+ "title": "Batch process a folder of workbooks, adding a standard disclaimer comment to each worksheet's top-left cell."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "change-the-font-color-of-a-comment-by-assigning-a-red-value-to-shapetextbodyfontcolor.cs",
+ "title": "Change the font color of a comment by assigning a red value to Shape.TextBody.Font.Color."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "change-the-font-color-of-comments-in-column-g-to-blue-using-shapetextbodyfontcolor.cs",
+ "title": "Change the font color of comments in column G to blue using Shape.TextBody.Font.Color."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "compare-two-workbooks-by-extracting-their-threaded-comments-and-identifying-differences-in-author-attribution.cs",
+ "title": "Compare two workbooks by extracting their threaded comments and identifying differences in author attribution."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "copy-a-threaded-comment-from-cell-e5-to-cell-f6-while-preserving-its-author-and-text.cs",
+ "title": "Copy a threaded comment from cell E5 to cell F6 while preserving its author and text."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "copy-formatting-of-a-comments-shape-including-background-color-and-font-color-to-another-comment.cs",
+ "title": "Copy formatting of a comment's shape, including background color and font color, to another comment."
+ },
{
"category": "comments-and-notes",
"file": "create-a-new-workbook-and-add-a-threaded-comment-to-cell-a1-with-author-john.cs",
"title": "Create a new workbook and add a threaded comment to cell A1 with author John."
},
+ {
+ "category": "comments-and-notes",
+ "file": "create-a-workbook-add-threaded-comments-to-multiple-cells-and-save-the-file-in-xlsx-format.cs",
+ "title": "Create a workbook, add threaded comments to multiple cells, and save the file in XLSX format."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "edit-a-specific-threaded-comment-by-setting-its-text-property-to-a-new-string-value.cs",
+ "title": "Edit a specific threaded comment by setting its Text property to a new string value."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "iterate-through-a-threadedcommentcollection-to-display-each-comments-text-author-and-creation-timestamp.cs",
+ "title": "Iterate through a ThreadedCommentCollection to display each comment's text, author, and creation timestamp."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "load-a-workbook-modify-comment-font-colors-based-on-author-and-save-changes-to-a-new-file.cs",
+ "title": "Load a workbook, modify comment font colors based on author, and save changes to a new file."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "load-an-existing-workbook-retrieve-all-threaded-comments-from-column-b-and-list-their-authors.cs",
+ "title": "Load an existing workbook, retrieve all threaded comments from column B, and list their authors."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "read-all-threaded-comments-from-a-worksheet-and-count-the-number-of-comments-per-author.cs",
+ "title": "Read all threaded comments from a worksheet and count the number of comments per author."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "read-the-author-of-each-threaded-comment-in-a-worksheet-and-output-the-list.cs",
+ "title": "Read the author of each threaded comment in a worksheet and output the list."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "remove-a-threaded-comment-from-cell-c3-using-the-remove-method-on-the-comment-object.cs",
+ "title": "Remove a threaded comment from cell C3 using the Remove method on the comment object."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "remove-all-comments-older-than-thirty-days-from-a-workbook-based-on-their-createdtime-values.cs",
+ "title": "Remove all comments older than thirty days from a workbook based on their CreatedTime values."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "replace-the-background-picture-of-a-comment-with-a-semi-transparent-overlay-image.cs",
+ "title": "Replace the background picture of a comment with a semi-transparent overlay image."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "retrieve-and-display-the-total-number-of-threaded-comments-present-in-a-workbook.cs",
+ "title": "Retrieve and display the total number of threaded comments present in a workbook."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "scan-a-workbook-for-empty-comments-and-remove-them-to-clean-metadata.cs",
+ "title": "Scan a workbook for empty comments and remove them to clean metadata."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "set-the-text-direction-of-a-comments-shape-to-righttoleft-for-bidirectional-language-support.cs",
+ "title": "Set the text direction of a comment's shape to RightToLeft for bidirectional language support."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "set-the-text-direction-of-a-comments-shape-to-toptobottom-for-vertical-annotation-layout.cs",
+ "title": "Set the text direction of a comment's shape to TopToBottom for vertical annotation layout."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "update-the-font-color-of-all-comments-authored-by-alice-to-green-using-shapetextbodyfontcolor.cs",
+ "title": "Update the font color of all comments authored by Alice to green using Shape.TextBody.Font.Color."
+ },
+ {
+ "category": "comments-and-notes",
+ "file": "update-the-text-direction-of-all-comments-in-a-worksheet-to-lefttoright-for-standard-layout.cs",
+ "title": "Update the text direction of all comments in a worksheet to LeftToRight for standard layout."
+ },
{
"category": "timeline",
"file": "add-interactive-hyperlinks-to-timeline-markers-that-open-related-worksheets-when-the-pdf-is-viewed.cs",