Convert XBRL to HTML using C#

XBRL (eXtensible Business Reporting Language) is an XML-based markup language used for standardized business reporting of a company’s financial performance. It provides a way to communicate and exchange business information between business systems. In certain cases, we may need to extract and share XBRL data in an HTML webpage to view in web browsers. In this article, we will learn how to convert XBRL to HTML using C#.

The following topics shall be covered in this article:

  1. C# XBRL to HTML Converter API
  2. Convert XBRL to HTML
  3. Export XBRL XML to HTML

C# API to Convert XBRL to HTML

For converting XBRL to an HTML file, we will follow a two-step procedure. Firstly, we will be using the Aspose.Finance for .NET to convert XBRL to XLSX, and then we will convert the XLSX to HTML using Aspose.Cells for .NET APIs.

Please either download the DLLs of the APIs or install them using NuGet.

PM> Install-Package Aspose.Finance
PM> Install-Package Aspose.Cells

Convert XBRL to HTML in C#

We can easily convert the XBRL files (.xbrl) to HTML webpages by following the steps given below:

  1. Firstly, load the XBRL file using the XbrlDocument class.
  2. Next, create an instance of the SaveOptions class and set the SaveFormat as XLSX.
  3. Then, convert XBRL to XLSX and save it in a FileStream object using XbrlDocument.Save() method.
  4. After that, open the XLSX FileStream object using the Workbook class.
  5. Finally, call the Workbook.Save() method to save the document in HTML format. It takes the output file path and the SaveFormat type (HTML) as arguments.

The following code sample demonstrates how to convert XBRL to HTML using C#.

Convert XBRL to HTML in C#.

Convert XBRL to HTML in C#.

Export XBRL XML to HTML using C#

We can also convert the XBRL data from an XML file (.xml) to an HTML webpage by following the steps mentioned earlier. However, we just need to input the .xml file instead of the .xbrl file in the first step.

The following code sample demonstrates how to export data from an XML file to HTML using C#.

Get a Free License

You can get a free temporary license to try the library without evaluation limitations.

Conclusion

In this article, we have learned how to convert an XBRL file to an HTML webpage. We have also seen how to save XBRL data from an XML file to HTML programmatically. Besides, you can learn more about Aspose.Finance for .NET API using documentation. In case of any ambiguity, please feel free to contact us on our free support forum.

See Also