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

Access original cell value from custom tag #364

Open
gknyihar opened this issue Jul 19, 2024 · 0 comments
Open

Access original cell value from custom tag #364

gknyihar opened this issue Jul 19, 2024 · 0 comments

Comments

@gknyihar
Copy link

I want to create a new custom tag that replaces all null values with #N/A. I can replace cell values from the tag but cannot distinguish empty strings from null because it outputs the same value to the cell. So, I need to inspect the original values accessible from the ProcessingContext Value property, but I cannot map the cell to the proper value.

public class NullableTag : OptionTag
{
    public override void Execute(ProcessingContext context)
    {
        var dataSource = context.Value as IDataSource;
        var range = context.Range;

        range.Cells().ToList().ForEach(cell =>
        {
            var row = range.FindRow(r => r.Contains(cell));
            var values = dataSource.GetValue(row);

            var value = ... // get value from values by cell address

            if (value == null)
            {
                cell.FormulaA1 = "=NA()";
            }

        });
    }

}

Could you point me in the right direction?

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

1 participant