Find if the Worksheet is Dialog Sheet with C++

Possible Usage Scenarios

Dialog Sheet is an older sheet format that contains a dialog box. Such a sheet could be inserted by an earlier version of Microsoft Excel, e.g., 2003, as shown in this screenshot. It can also be inserted with VBA in newer versions, e.g., Microsoft Excel 2016.

todo:image_alt_text

You can find if the sheet is a dialog sheet or some other type of sheet with the Worksheet.GetType() property provided by Aspose.Cells. If it returns the enumeration value SheetType.Dialog, then it means you are dealing with a dialog sheet.

Find if the Worksheet is Dialog Sheet

The following sample code loads the sample Excel file that contains a dialog sheet. It checks the Worksheet.GetType() property, compares it with SheetType.Dialog, and then prints the message. Please see the console output of the sample code given below for more help.

Sample Code

#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;

int main()
{
    Aspose::Cells::Startup();

    // For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C

    // Load Excel file containing Dialog Sheet
    Workbook workbook(u"sampleFindIfWorksheetIsDialogSheet.xlsx");

    // Access first worksheet
    Worksheet ws = workbook.GetWorksheets().Get(0);

    // Find if the sheet type is dialog and print the message
    if (ws.GetType() == SheetType::Dialog)
    {
        std::cout << "Worksheet is a Dialog Sheet." << std::endl;
    }

    Aspose::Cells::Cleanup();
}

Console Output

Worksheet is a Dialog Sheet.