DocumentProperty.ToBool
DocumentProperty.ToBool method
Returns the property value as bool.
public bool ToBool()
Remarks
Throws an exception if the property type is not PropertyType.Boolean.
Examples
using System;
using Aspose.Cells;
using Aspose.Cells.Properties;
namespace AsposeCellsExamples
{
public class DocumentPropertyMethodToBoolDemo
{
public static void Run()
{
Workbook workbook = new Workbook();
CustomDocumentPropertyCollection customProperties = workbook.Worksheets.CustomDocumentProperties;
// Add a boolean custom document property
customProperties.Add("IsApproved", true);
// Get the property and convert to bool using ToBool()
DocumentProperty isApprovedProperty = customProperties["IsApproved"];
bool isApproved = isApprovedProperty.ToBool();
Console.WriteLine($"Is Approved: {isApproved}");
}
}
}
See Also
- class DocumentProperty
- namespace Aspose.Cells.Properties
- assembly Aspose.Cells