Comparing VSTO with Aspose.Cells for .NET

Overview

Microsoft Excel is used widely by businesses and individuals in all kinds of industries. The spreadsheet application is close to ubiquitous and allows users not just to store and organize data, but to build complex models with formulas and present data clearly with advanced formatting and charts.

VSTO allows Microsoft Office documents to execute code wrapped in a .NET assembly. It is used to develop applications that work with Microsoft Office files and features. Developers have used ASP, Office Web components, and COM interop in applications for years. Microsoft has enhanced VSTO to make developing and deploying applications easier and improve memory management. But the question remains: is VSTO designed to be easier to use and more reliable than other approaches available today? Developers want to work with solutions that won’t let them down in terms of improved performance, security, scalability, stability, reliability, or features.

Aspose provides a great line of .NET, Java, Cloud, and Android APIs. Aspose APIs include products such as Aspose.Cells, Aspose.Words, Aspose.Pdf, and Aspose.Slides—APIs that help developers open, modify, generate, save, merge, and convert documents in various formats including XLS, XLSX, DOC, DOCX, HTML, PDF, PPT.

In this article, we compare VSTO with Aspose.Cells for .NET.

Aspose.Cells is an independent Microsoft Excel spreadsheet‑manipulation API that reads and writes Microsoft Excel spreadsheets without Microsoft Excel installed on the client or server side. Aspose.Cells is a feature‑rich component and offers much more than just basic data export. With Aspose.Cells developers can export data, format spreadsheets, import images, create and manipulate charts, stream Excel data, and save to various formats. To find out more about the product and its features:

This article compares VSTO and Aspose.Cells on different aspects related to Microsoft Excel. The list is not complete, but it represents a few issues that decision makers must understand before making a final decision adopting an approach.

.NET Framework Requirement

VSTO requires the .NET Framework (including Visual Studio Tools for Office SE Runtime) on the client side to execute the final application. In most corporate environments, especially in web scenarios, end‑users cannot install application software and the related run‑time frameworks. This requirement alone makes VSTO‑based applications problematic. It practically rules out off‑the‑shelf applications based on VSTO.

On the contrary, Aspose.Cells for .NET does not necessarily demand the .NET Framework on the client side for the underlying scenario. The Office applications built with the component are lightweight and guaranteed to work on Microsoft Windows systems under significant load.

Features

The features that VSTO provides depend on which combination of VSTO and Visual Studio products you have installed. Common tasks performed by VSTO for Microsoft Office Excel 2003 include adding data to cells, creating, opening, and saving workbooks, adding, moving, and hiding worksheets, protecting worksheets, named ranges, list objects, style formatting, searching text in cells, sorting data, printing, and Excel formula calculations.

Aspose.Cells provides everything necessary to manage Microsoft Office Excel files plus much, much more. The API gives developers great results with the least amount of effort. Aspose.Cells provides many powerful, time‑saving functions. The API provides easy‑to‑use interfaces for all types of spreadsheet‑management activities, covering almost all the features Microsoft Excel provides. All the tasks listed for VSTO can easily be performed by Aspose.Cells.

Aspose.Cells also supports several advanced features, including support for Smart Markers, importing and exporting data to and from a number of data sources, objects, and Excel files, support for COM clients (ASP client) interoperability with the component, converting Excel files to PDF format, and saving Excel charts and worksheets as image files.

Security

By default, VSTO applications require Full‑Trust permissions for execution, as they do not allow partially trusted callers. To lock down a web application and provide an additional level of isolation in a hosted environment, you can use code‑access security to restrict the resources the application can access and the privileged operations it can perform. But you need to invest some time and effort to understand .NET security.

Internet Service Providers (ISPs) that host multiple applications from many different companies frequently use the Medium‑Trust level to help ensure that applications cannot read each other’s data or interfere with one another. For security reasons, the ISPs may limit individual web applications on shared servers to Partial Trust.

Aspose.Cells for .NET can run under the Medium‑Trust security level. No special privileges are required to run the assembly in a hosted environment. Medium trust places restrictions on the types of shared system resources that the applications can access. Many web applications run on web‑hosting servers that can only operate under Medium Trust. Aspose.Cells for .NET serves their needs very well in this regard.

Performance

Performance is the most critical factor when choosing any approach or methodology to build a solution.

The performance of a VSTO application relies on VBA and COM approaches according to some users’ reports. Several factors influence VSTO performance, and it is important to put these factors in perspective.

  • The .NET startup cost is inherently expensive. Applications written with .NET must incur the overhead of Just‑In‑Time (JIT) compilation, so the JIT compilation cannot be avoided.
  • Another performance factor influencing VSTO‑based applications is the expense of calling through the thick layers of automation that wrap the Microsoft Office COM objects. VBA, built and optimized to interact with Microsoft Office, has a shorter distance to travel than .NET.
  • Finally, hosting Excel objects in the Visual Studio IDE is expensive in terms of resources. VSTO applications have a larger memory footprint than VBA applications. VSTO Excel applications use a lot of memory and never release it back to the OS until all instances of Microsoft Excel are closed.

If you are considering adopting VSTO as a development platform for Microsoft Office technology, spend some time looking into resources to become familiar with these attributes.

Moreover, the performance implication of always checking for updates may not be appropriate for the solution (slower deployment servers, slower network connections, or simply being unable to reach the server frequently can negatively impact load times).

In contrast, Aspose.Cells for .NET is highly scalable, flexible, and fast. Generally, Office applications were not designed to be simultaneously used by hundreds or thousands of users; however, Aspose.Cells is. The API is stable and can perform spreadsheet tasks flawlessly whether on a single server, powering a single application, or on a load‑balanced web farm powering an enterprise‑wide application.

System Requirements

Analyzing the system requirements for these two approaches, we find that VSTO is more expensive and needs more essential components.

VSTO has a long list of prerequisites:

  • Supported Operating Systems: Windows 2000; Windows Server 2003; Windows Vista; Windows XP
  • .NET Framework versions supported: only .NET Framework 2.0 or greater.
  • One or more of the following editions of Visual Studio Tools for Office:
    • Microsoft Visual Studio 2005 Tools for the Microsoft Office System
    • Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System
    • Visual Studio 2008 Professional Edition
    • Visual Studio 2008 Team Suite Edition
  • One version of Microsoft Office:
    • Microsoft Office Professional 2003 SP1
    • Microsoft Office 2007 system

Aspose.Cells does not require Microsoft Excel to be installed either on the client or on the server, as it is a spreadsheet‑creation engine. To view Microsoft Excel documents, however, you need at least Microsoft Excel Viewer installed on the system.

  • Supported Operating Systems: Windows 2000; Windows Server 2003; Windows Vista; Windows XP
  • .NET Framework versions supported: all .NET frameworks are supported (1.0, 1.1, 2.0, 3.x, etc.).

Installation and Deployment

Installing VSTO can be a big and troublesome task. Occasionally, an installation demands that you manually reinstall aspects of the tools and register them manually too. It can get complicated.

On the other hand, Aspose.Cells for .NET is packaged into a single DLL, so there is no need to install additional applications. The component is only used by .NET applications and no portion of the component code is designed to wait on a human response. Just visit the Aspose.Cells download page and download the latest Aspose.Cells installer. Run the downloaded file and follow the installer instructions. Then, to use the component, reference it in your project.

Example Task

To show the differences between the two approaches, the code below shows how to use both VSTO and Aspose.Cells APIs to fill a template file with data.

  1. A Microsoft Excel file (TempBook.xls) is used as a template. The workbook contains a few worksheets with a few cells filled with data.
  2. The example code puts 1 000 × 20 records on the first worksheet in the template Excel file. The worksheet is filled with constant (dummy) data in the cells.

The task is performed on a system having an Intel(R) Celeron(R) CPU 2.40 GHz, 760 MB of RAM, running Microsoft Windows XP Professional.

The code segments below illustrate how to perform these tasks with each API.

VSTO Code

Aspose.Cells Code

Results

The results showed that using the VSTO API took about 2.5 minutes (approximately 150 seconds) to finish the task, while Aspose.Cells used less than 1 second on common hardware with normal system configurations.

If the loop is extended, say to fill 10 000 × 20 cells, Aspose.Cells takes about 5.5 seconds to do the job.

Conclusion

If you are considering using a Microsoft Office technology in a business solution, first become familiar with the alternatives available. Perform some tests based on different products and expose them to a variety of real‑world conditions such as load and stress to see how well they perform.

Aspose.Cells is a stable and mature product with a worldwide customer base, and it is scalable enough to perform well under heavy loads.

The performance of VSTO is not refined yet. It is quite possible that some of these performance issues do not relate to VSTO itself but have connections with .NET JIT compilation processes. Still, there are doubts whether VSTO applications would scale as the load increases. The newer model of VSTO does not require Excel to reside on the web server for document processing, but VSTO still has a long way to go to make a real impact.