Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8009721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:31:40+00:00 2026-06-04T18:31:40+00:00

I am having some problems working with comments in Excel docs using EPPlus. I

  • 0

I am having some problems working with comments in Excel docs using EPPlus. I can add comments and remove them, however sometimes it isn’t successful.

I am using the comments to display validation messages from the result of processing the Excel file, and when this file gets re-processed, I want to clear any existing comments before running the validation again.

My current method of clearing the comments is this:

  _sheet.Cells.Style.Fill.PatternType = ExcelFillStyle.None;
  while (_sheet.Comments.Count > 0)
  {
      // Note: not using _sheet.Comments.RemoveAt(0) since this can throw [Exception: Key does not exist] OfficeOpenXml.RangeCollection.Delete(UInt64 key) 
      _sheet.Comments.RemoveAt(_sheet.Comments.Count - 1);
  }

Which seems to clear them fine. But when I try to add a comment as below:

  const string author = "...";
  cell.Style.Fill.PatternType = ExcelFillStyle.Solid;
  cell.Style.Fill.BackgroundColor.SetColor(Color.LemonChiffon);
  if (cell.Comment == null)
  {
      cell.AddComment(message, author);
  }
  else
  {
      cell.Comment.Text = message;
      cell.Comment.Author = author;
  }

where cell is an ExcelRange instance for a specific cell, I get the below stack trace:

System.NullReferenceException : Object reference not set to an instance of an object.
at OfficeOpenXml.Drawing.Vml.ExcelVmlDrawingCommentCollection.AddDrawing(ExcelRangeBase cell)
at OfficeOpenXml.Drawing.Vml.ExcelVmlDrawingCommentCollection.Add(ExcelRangeBase cell)
at OfficeOpenXml.ExcelComment..ctor(XmlNamespaceManager ns, XmlNode commentTopNode, ExcelRangeBase cell)
at OfficeOpenXml.ExcelCommentCollection.Add(ExcelRangeBase cell, String Text, String author)
at OfficeOpenXml.ExcelRangeBase.Set_Comment(Object value, Int32 row, Int32 col)
at OfficeOpenXml.ExcelRangeBase.SetSingle(_setValue valueMethod, Object value)
at OfficeOpenXml.ExcelRangeBase.AddComment(String Text, String Author)

Can anyone help me with this? What am I doing wrong?

Thanks,

James

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:31:41+00:00Added an answer on June 4, 2026 at 6:31 pm

    I contacted Jan Kallman regarding this, and it turned out to be a bug with the VML drawings not being sorted, and was fixed in the patch / commit 5027f556c029 of the library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some problems trying to get a background upload system working using WebWorkers
I am working in a project using openframeworks and I've been having some problems
I am having some problems getting a larger application with many table relationships working
I'm wanting to get a WCF-over-TCP service working. I was having some problems with
I'm having some problems with eVB. How can I put a menu bar in
I'm having some problems working with NSStrings in Objective C... the code below returns
I'm working with Drupal 7 User Relationships and I'm having some problems with mutual
Having some problems with customizing the UINavigationController. The size change is working, but the
I am having some problems with a javascipt function which I'm working on. Here
I'm having some problems with the php script below that I'm currently working on.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.