We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Culture failed for linux box when generating image

Please see my code

using (var ms = new FileStream("/tmp/various-objects.xlsx", FileMode.OpenOrCreate, FileAccess.Read))
ms.Position = 0;
using (var workbook = new Workbook(ms))
Stopwatch s = new Stopwatch();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.PageSetup.PrintArea = “A1:N50”;

				// Set all margins as 0
				worksheet.PageSetup.LeftMargin = 0;
				worksheet.PageSetup.RightMargin = 0;
				worksheet.PageSetup.TopMargin = 0;
				worksheet.PageSetup.BottomMargin = 0;

				// Set OnePagePerSheet option as true
				ImageOrPrintOptions options = new ImageOrPrintOptions();
				options.OnePagePerSheet = true;
				options.ImageType = Aspose.Cells.Drawing.ImageType.Png;
				options.OnlyArea = true;
				//options.HorizontalResolution = 90;
				//options.VerticalResolution = 90;
				SheetRender sr = new SheetRender(worksheet, options);
				using (var msImg = new MemoryStream())
					sr.ToImage(0, msImg);
					sr.ToImage(0, "/tmp/" + Guid.NewGuid() + ".png");

Running under Linux always throw an error. We understand that this might be related to the missing culture or miss mapping the LCID. However, if you have ever experienced this issue before, please provide the workaround solution. Thanks

various-objects.xlsx.zip (1.2 MB)


We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNETCORE-18 - Exception "A generic error occurred in GDI+" while rendering sheet to image


Do we have any update regarding this?


We are working on it and will let you know once it will be fixed.


We have found the reason to be related with System.Drawing.Common library which is reported to Microsoft. Moreover, equation drawing function will be removed in next version to avoid its impact on other drawing functions in Aspose.Cells.

Once we have an update on it, we will let you know here.

Appreciate your support.
We are looking forward to hearing from you soon


You are welcome.


Please try our latest version/fix: Aspose.Cells for .NET v19.3.1:

Aspose.Cells19.3.1 For .NetStandard20.Zip (4.0 MB)
Aspose.Cells19.3.1 For .Net2_AuthenticodeSigned.Zip (4.8 MB)
Aspose.Cells19.3.1 For .Net4.0.Zip (4.8 MB)

For this problem, we have removed equation drawing on linux (only for .NetCore version), to avoid it impacts other drawing functions. Please try the fix/version: Aspose Cells 19.3.1, the equation will not cause crash again on linux (also equation will not be drawn on linux, but other things can be drawn correctly).