Supported Platforms
GemBox.Spreadsheet support for file formats depends on the used framework as following:
Support on Linux or macOS
When using GemBox.Spreadsheet on a non-Windows platform, such as Linux or macOS, the HarfBuzzSharp package is used for text layout and the SkiaSharp package is used for rasterizing workbook content to a bitmap. For bitmap decoding and encoding, GemBox.Spreadsheet uses SkiaSharp or SixLabors.ImageSharp packages.
These packages are required for saving to PDF or image formats, so your project must reference an appropriate HarfBuzzSharp.NativeAssets.* and SkiaSharp.NativeAssets.* NuGet packages depending on the platform on which your application is running.
Please note that the following features are currently not supported on non-Windows platform:
- Printing workbooks.
- Saving workbooks to XPS.
- Calling ConvertToImageSource and ConvertToXpsDocument methods.
Support on Windows
When using GemBox.Spreadsheet on a Windows operating system, the WPF is used for text layout, rasterizing workbook content to a bitmap, and bitmap decoding and encoding.
In order for the application to use WPF, it must target .NET Framework 3.5+, or target .NET 6.0+ with the Windows-specific TFM (e.g. "net6.0-windows") and a .NET Windows Desktop Runtime must be installed.
However, you can avoid using WPF, and instead use the same packages as for non-Windows platforms, by setting the RenderingMode property. This is useful in cases where an application is converting workbooks to images with multiple threads because switching from RenderingMode.WPF to RenderingMode.Skia will then avoid creating a WPF Dispatcher instance for each thread.
Note
The SkiaSharp package is always used when saving the workbook to an SVG image, regardless of the specified ImageSaveOptions.RenderingMode
. Because of that, for SVG support your application needs to target at least .NET Framework 4.6.2. Lower .NET Framework versions, 3.5 to 4.6.1, don't support SVG output format.
Important
The System.Drawing.Common package (GDI+) is used when exporting workbook images in SVG, WMF, and EMF format.
Support on Windows server
When saving to XPS or image format in an ASP.NET Core application using the WPF, you need a .NET Windows Desktop Runtime installed on the Windows server and you need to use a Windows-specific TFM in the project file (e.g. <TargetFramework>net6.0-windows</TargetFramework>
).
Also, you need to enable the following compatibility switch with the AppContext class:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
// Add compatibility switch.
AppContext.SetSwitch("Switch.System.Windows.Media.ShouldRenderEvenWhenNoDisplayDevicesAreAvailable", true);
}
public IConfiguration Configuration { get; }
// ...
}
Alternatively, you can enable that compatibility switch by adding the following runtimeconfig.template.json file to your project:
{
"configProperties": {
"Switch.System.Windows.Media.ShouldRenderEvenWhenNoDisplayDevicesAreAvailable": true
}
}
Support for Partially Trusted applications
Most Internet Service Providers restrict hosted ASP.NET applications to Medium Level Trust and by doing so, disable accessing files outside the application directory, among other things, as explained in trust Element (ASP.NET Settings Schema) level Attribute.
GemBox.Spreadsheet support for Partially Trusted applications depends on the used file formats as follows:
- Excel Workbooks (XLSX), Excel 97-2003 Workbooks (XLS), OpenDocument Spreadsheets (ODS), Character-separated-values text files (CSV), Fixed-columns-width text files (TXT), and Web Pages (HTML) are fully supported in Partially Trusted applications.
- Adobe Portable Document Format (PDF) is supported in Partially Trusted applications if font location is set to a directory that is available to the Partially Trusted application.
Important
Setting the font location directory is necessary for Partially Trusted applications because they can only access files inside the application directory, and font files are, by default, located in C:\Windows\Fonts, which is not accessible for Partially Trusted applications. For more information on how to set the font location directory, see the Private Fonts example. Font files are usually copyrighted, so make sure you conform to the font license before copying a font file to another location.
- Creating a digitally signed PDF file is not supported in Partially Trusted applications because does not work in partial trust.
- Microsoft XMP Paper Specification (XPS) is not supported in Partially Trusted applications because ReachFramework.dll assembly, where most of the XPS implementation resides, is not decorated with .
- Image formats (PNG, JPEG, GIF, BMP, TIFF, WMP) are not supported in Partially Trusted applications because class and its derived classes, used for writing image data to the specific image file format, do not work in partial trust.
- Printing is not supported in Partially Trusted applications because it uses XPS infrastructure.
- Using Skia rendering mode is not supported because it uses unmanaged code.