Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Use the property Cell.Comment to return a Comment object.
    Code Block
    c#
    c#
    ExcelApplication xla = new ExcelApplication();
    Workbook wb = xla.Create();
    Worksheet ws = wb.Worksheets[0];
    
    Cell cellB5 = ws.Cells["B5"];
    Comment comm = cellB5.Comment;
    
  2. Add text to the comment.
    Code Block
    c#
    c#
    comm.Text = "Figures for March are projected.";
  3. Specify the author of the comment.
    Code Block
    c#
    c#
    comm.Author = "John Doe";
  4. Set whether the comment will be visible when the document is opened in Excel. By default, the comment will be hidden, and will be displayed only if the user hovers over the comment's cell.
    Code Block
    c#
    c#
    comm.Visible = true;
  5. To modify the comment's display area, return its Shape object and set Shape properties, for example:
    Code Block
    c#
    c#
    Shape commShape = comm.Shape;
    commShape.FillColor = oColor;
    commShape.FitToText = true;
    

...

Image Added

Creating a Picture

Pictures in a worksheet are stored in the Pictures collection. To add a picture to a worksheet:

...