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

Cannot convert referenced Cell value in another sheet to System.String #1217

Open
1 of 2 tasks
yteruel31 opened this issue May 27, 2019 · 1 comment
Open
1 of 2 tasks

Comments

@yteruel31
Copy link

yteruel31 commented May 27, 2019

Read and complete the full issue template

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

  • Bug
  • Feature

If you are logging a possible bug or feature request, please test with the latest development build first.

Version of ClosedXML

0.94.2

What is the current behavior?

I want to get the value monetary value in E17 but I get this error :

Cannot convert Test!E17's value to System.String

What is the expected behavior or new feature?

Complete this.

Did this work in previous versions of our tool? Which versions?

No

Reproducibility

This is an important section. Read it carefully. Failure to do so will cause a 'RTFM' comment.

Without a code sample, it is unlikely that your issue will get attention. Don't be lazy. Do the effort and assist the developers to reproduce your problem. Code samples should be minimal complete and verifiable. Sample spreadsheets should be attached whenever applicable. Remove sensitive information.

Code to reproduce problem:

[Test]
public void Default_Case()
{
        object value;
        using (Stream stream = TestHelper.GetStreamFromResource(TestHelper.GetResourcePath(@"Examples\test.xlsx")))
        {
            using (XLWorkbook wb = new XLWorkbook(stream, XLEventTracking.Disabled))
            {
                IXLWorksheet ws = wb.Worksheet("Test");
                IXLRow row = ws.Row(17);
                IXLCell cell = row.Cell(6);
                value = cell.Value;
            }
       }

       Assert.AreEqual(32,value);
}
  • [x ] I attached a sample spreadsheet. (You can drag files on to this issue)

test.xlsx

@jesslilly
Copy link

Hi! There is a workaround for this issue! Use CachedValue instead of Value or GetString().

See my stack overflow answer for more details: https://stackoverflow.com/a/65079250/1804678

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

No branches or pull requests

2 participants