# Detect the Format of a File

You can detect the format of a file by using the `detect` method. For example:

    auto myinput = keyview::io::InputFile{ std::string("InputFile.docx") };
    auto detection_info = KV.detect(myinput);

    // Print out what we found
    std::cout << "Format:\t" << static_cast<int>(detection_info.format()) << "\n";
    std::cout << "Description:\t" << detection_info.description() << "\n";
    std::cout << "Version:\t" << detection_info.version() << "\n";
    std::cout << "Category:\t" << static_cast<int>(detection_info.category()) << "\n";
    std::cout << "Category Name:\t" << detection_info.category_name() << "\n";
    std::cout << "Encrypted:\t" << std::boolalpha << detection_info.encrypted() << "\n";

_FT_HTML5_bannerTitle.htm