Convert HTML to XPS via C#
Export Excel spreadsheets to XPS format on .NET Framework, .NET Core, Mono or Xamarin Platforms.
How to Convert HTML to XPS Using C#
In order to convert HTML to XPS, we will use Aspose.Cells for .NET API which is a feature-rich, powerful and easy to use document manipulation and conversion API for C# platform. Open NuGet package manager, search for Aspose.Cells and install. You may also use the following command from the Package Manager Console.
Package Manager Console Command
PM> Install-Package Aspose.Cells
Steps to Convert HTML to XPS via C#
.NET developers can easily load & convert HTML files to XPS in just a few lines of code.
- Load HTML file with an instance of Workbook
- Call the Workbook.Save method
- Pass output path with XPS extension as parameter
- Check specified path for resultant XPS file
Before running the .NET conversion example code, make sure that you have the following prerequisites.
- Microsoft Windows or a compatible OS with .NET, .NET Core, Mono or Xamarin Platforms..
- Development environment like Microsoft Visual Studio.
- Add reference to the Aspose.Cells for .NET DLL in your project.
HTML What is HTML File Format
XPS What is XPS File Format
An XPS file represents page layout files that are based on XML Paper Specifications created by Microsoft. It was developed as a replacement of EMF file format and is similar to PDF file format, but uses XML in layout, appearance, and printing information of a document. It is, in fact, more justified to say that XPS is an attempt on PDF, but could not get enough popularity as owned by PDF for many reasons. Microsoft provides XPS Document Writer by default from Windows 7 onwards for the creation of XPS files. XPS files can be generated by selecting the "Microsoft XPS Document Writer" as printer while printing the document.Read More
Other Supported Conversions
You can also convert HTML into many other file formats including few listed below.