Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cell property HasComment is True but GetComment() returns empty object #1920

Open
3 of 6 tasks
AndrewKhloptsau opened this issue Nov 23, 2022 · 3 comments · May be fixed by #2047
Open
3 of 6 tasks

Cell property HasComment is True but GetComment() returns empty object #1920

AndrewKhloptsau opened this issue Nov 23, 2022 · 3 comments · May be fixed by #2047

Comments

@AndrewKhloptsau
Copy link

AndrewKhloptsau commented Nov 23, 2022

Do you want to request a feature or report a bug?

  • Bug
  • Feature
  • Question

Did you test against the latest CI build?

  • Yes
  • No

Version of ClosedXML
0.95.0
0.97.0
0.97.1 - preview

What is the current behavior?

I try to export google sheet with Notes as xlsx file.
image

And exported file looks like this in Excel. All Notes have been changed to Comments.
image

But when I try read comment in code the next behavior is a bit unexpected.

using ClosedXML.Excel;

using var workbook = new XLWorkbook(Path.Combine(Environment.CurrentDirectory, "Test ClosedXML.xlsx"));

workbook.TryGetWorksheet("Sheet1", out var sheet);

foreach (var row in sheet.Rows())
{
    var cell = row.Cells().FirstOrDefault();

    Console.WriteLine(cell?.Value.ToString() + ' ' + cell?.HasComment + ' ' + cell?.GetComment());
}

image

Also if I try resave the file all comments just disappear:

using ClosedXML.Excel;

using var workbook = new XLWorkbook(Path.Combine(Environment.CurrentDirectory, "Test ClosedXML.xlsx"));

workbook.SaveAs(Path.Combine(Environment.CurrentDirectory, "Result.xlsx"));

image

What is the expected behavior or new feature?

I'd like to read comments like in Excel file.

Is this a regression from the previous version?
I've checked this code on version 0.95.0 The problem is reproduced too.

Reproducibility

Code to reproduce problem:
I'm using .Net 6. Test file has been attached to issue.

  • First case
using ClosedXML.Excel;

using var workbook = new XLWorkbook(Path.Combine(Environment.CurrentDirectory, "Test ClosedXML.xlsx"));

workbook.TryGetWorksheet("Sheet1", out var sheet);

foreach (var row in sheet.Rows())
{
    var cell = row.Cells().FirstOrDefault();

    Console.WriteLine(cell?.Value.ToString() + ' ' + cell?.HasComment + ' ' + cell?.GetComment());
}
  • Second case
using ClosedXML.Excel;

using var workbook = new XLWorkbook(Path.Combine(Environment.CurrentDirectory, "Test ClosedXML.xlsx"));

workbook.SaveAs(Path.Combine(Environment.CurrentDirectory, "Result.xlsx"));
NickNack2020 added a commit to NickNack2020/ClosedXML that referenced this issue Apr 2, 2023
@NickNack2020 NickNack2020 linked a pull request Apr 2, 2023 that will close this issue
@tiagoalmeidadarosa
Copy link

I have the same problem here, could you please merge the PR? @NickNack2020 😃

@NickNack2020
Copy link
Contributor

NickNack2020 commented Nov 18, 2023

@tiagoalmeidadarosa a maintainer like @jahav has to merge the associated PR. I want to be an active contributor to ClosedXML and have submitted multiple PRs, but I gave up and stopped contributing when PRs are not being merged or responded too. As you can see this PR has been open for over 6 months.

@NickNack2020
Copy link
Contributor

NickNack2020 commented Nov 18, 2023

It was stated in a past issue that @jahav is focused on core technical debt more so then bug fixes see (#2161) I don't disagree with the fact that his time can best be spent here, but then I wish we were more willing to accept community bug fixes from others. Getting others engaged in the project is what will help build up more knowledge and sustainable resources to keep the project health long term, but for now it seems like we are not focused on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants