Convert XLT to byte array via C#
Native and high performance Microsoft Excel XLT to byte array conversion or vice versa for spreadsheets data processing using server side .NET APIs.
Byte Array is helpful for data processing or storing. You can convert XLT file to Byte Array as well as a Byte Array to XLT document using C# language. In order to convert XLT to byte array, we’ll use
API that offers different features for document manipulation and conversion using .NET platform.
How to Convert XLT to Byte Array via C#
It is easy for the developers to load & convert XLT files to byte array for further manipulation tasks in just a few lines of code.
- Include the namespace in your class file
- Load input XLT File using Workbook
- Initialize MemoryStream object
- Convert stream data to byte array
- Process data as of your requirement
System Requirements
Just make sure that system have Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms as well as development environment like Microsoft Visual Studio.
- Install from command line as
nuget install Aspose.Cells
or via Package Manager Console of Visual Studio withInstall-Package Aspose.Cells
. - Alternatively, get the offline MSI installer or all DLLs in a ZIP file from downloads
This sample code shows XLT to byte array C# Conversion
Workbook workbook = new Workbook("sourceFile.xlt");
//Save the workbook in memory stream
MemoryStream ms = new MemoryStream();
workbook.Save(ms, SaveFormat.Xlt);
//Read bytes from memory stream
byte[] byte_array = new byte[ms.Length];
ms.Read(byte_array, 0, byte_array.Length);
// Process the memory stream byte array data as of your requirement
XLT What is XLT File Format?
Files with .xlt extension are template files created with Microsoft Excel which is a spreadsheet application which comes as part of Microsoft Office suite. Microsoft Office 97-2003 supported creating new XLT files as well as opening these. The latest version of Excel is still capable of opening this old format template files. Such a template file is used to quickly create new Excel files with default data and settings such as page formatting, font size, margins, charts, etc which can be further saved as new .xls files.
Read MoreOther Supported Conversions
You can also convert other file formats into byte array or vice versa including few listed below.