﻿using DocumentFormat.OpenXml;

namespace ClosedXML.Utils
{
    internal static class OpenXmlHelper
    {
        public static BooleanValue GetBooleanValue(bool value, bool defaultValue)
        {
            return value == defaultValue ? null : new BooleanValue(value);
        }

        public static bool GetBooleanValueAsBool(BooleanValue value, bool defaultValue)
        {
            return value.HasValue ? value.Value : defaultValue;
        }
    }
}

﻿using DocumentFormat.OpenXml;

namespace ClosedXML.Utils
{
    internal static class OpenXmlHelper
    {
        public static BooleanValue GetBooleanValue(bool value, bool defaultValue)
        {
            return value == defaultValue ? null : new BooleanValue(value);
        }

        public static bool GetBooleanValueAsBool(BooleanValue value, bool defaultValue)
        {
            return (value?.HasValue ?? false) ? value.Value : defaultValue;
        }
    }
}

Fix converter for possible null values.
Fix converter for possible null values.
