Page tree
Skip to end of metadata
Go to start of metadata

In addition to Charts, ExcelApplication allows you to add the following drawing objects to a worksheet:

  • Comments
    A comment is a note attached to a cell, or group of merged cells, that is separate from other cell content. A comment is represented by a Comment object.
     
  • Pictures
    A picture is a JPEG, PNG, BMP, or GIF image that is inserted in the worksheet. A picture is represented by a Picture object.

  • Shapes
    A shape may be one of Excel's ready-made AutoShapes or the display area of a comment or picture. A shape is represented by a Shape object.

Adding a Comment to a Worksheet

A comment must be associated with a cell. Once created, comments may not be moved between cells. To create a comment:

  1. Use the property Cell.Comment to return a Comment object.

  2. Add text to the comment.

  3. Specify the author of the comment.

  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.

  5. To modify the comment's display area, return its Shape object and set Shape properties, for example:

Creating a Picture

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

  1. Return a Pictures collection.

  2. Create a Picture object from a JPEG, PNG, BMP, or GIF image and insert it at a specified anchor in the worksheet. The anchor represents the position of the top-left corner of the picture in the worksheet.

  3. To modify the size, position, or formatting of a Picture, return its Shape object and set Shape properties, for example:

Creating an AutoShape

Excel's ready-made AutoShapes are represented by the Shapeclass. To create an AutoShape:

  1. Return a Shapes collection.

  2. Create a shape of a specified type and insert it at an anchor in the worksheet.

The ShapeType class contains the Excel AutoShapes supported by ExcelWriter. The specified anchor represents the position of the top-left corner of the shape in the worksheet.

 

 

 

  • No labels