Free Support Forum - groupdocs.com

How to check the file format is group docs viewer will support or not?

I want to check group docs viewer will support my file type…

how can i check it with either JavaScript or C#


Showcase :ASP.NET_MVC_Front_End

.

Net Framework 4.5

Hi there,


Thanks for using GroupDocs.Viewer for .NET.

GroupDocs.Viewer for .NET contains FileTypeNotSupportedException class that is thrown during document load, when the document format is not recognized or not supported by GroupDocs.Viewer. You can use following code to achieve this functionality:

try
{
ViewerConfig config = new ViewerConfig();
config.StoragePath = @“D:\storage”;

ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(<span style=“color: rgb(0, 0, 128); font-family: “Courier New”; font-size: small;”>config);
var DocInfo = htmlHandler.GetDocumentInfo(FileName);
}
catch (FileTypeNotSupportedException exp)
{
Console.WriteLine(exp.Message);
Console.ReadKey();
}


You can also get a complete list of supported document formats using GetSupportedDocumentFormats method. To read more about this method, please visit Getting all Supported Formats.

Have a nice weekend ahead.
Warm Regards