Is it possible to populate a comment on a worksheet using a smart marker?
Yes, it is possible to populate a comment on a worksheet using a smart marker in Aspose.Cells. You can utilize the SmartMarker
feature to dynamically insert comments based on your data source.
Here’s a simple example of how to do this:
- Prepare your template Excel file with a smart marker for comments, for example,
{{Comment}}
. - Use the following C# code to populate the comment:
// Load the template workbook
Workbook workbook = new Workbook("Template.xlsx");
// Create a data source
DataTable dataTable = new DataTable();
dataTable.Columns.Add("Comment");
dataTable.Rows.Add("This is a comment.");
// Set the data source
workbook.Worksheets[0].Cells.ImportDataTable(dataTable, true, "A1");
// Process smart markers
workbook.CalculateFormula();
workbook.Save("Output.xlsx");
In this example, replace "Template.xlsx"
with the path to your template file and ensure that the smart marker {{Comment}}
is placed in the appropriate cell where you want the comment to appear.
Please note that the smart marker feature is designed for use with Excel files, and comments will be inserted based on the data provided in the data source.
Are you talking about the Comment/Note object attached to one Cell? If so, this feature is not supported currently. It will be better to help us understanding your requirement if you can provide one sample file that contains the expected result so we may evaluate it further.
Yes.
This is what I’m thinking of:
image.png (36.5 KB)
And once workbook designer processes the template file, what I’m looking for is:
image.png (34.4 KB)
Given:
{
"name": "John Doe",
"age": 30,
"user_comment": "name has been updated"
}
Let me know if this provides the whole picture.
Thanks for the screenshots and details.
As previously mentioned, Aspose.Cells currently does not support processing Smart Markers for comments/notes. However, we have created the following new ticket(s) in our internal issue tracking system to evaluate the possibility of adding this support. If feasible, we will aim to provide the necessary fixes in accordance with the terms outlined in Free Support Policies.
Issue ID(s): CELLSNET-59123
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@yoohee
It’s threaded comments in your demo image, not note. The feature more looks like a chat. Please confirm you want to add comment or note?
Will you want to come style of the smart note/comment?
Note is fine for my use case.