We are using ASPOSE Total licensed version. We are not able to print Excel sheets using below code. I am using .Net 6. where System.Drawing is not supported.
Worksheet worksheet;
// Get the second sheet.
worksheet = workbook.Worksheets[1];
// Apply different Image/Print options.
Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
options.PrintingPage = PrintingPageType.Default;
SheetRender sr = new SheetRender(worksheet, options);
Console.WriteLine("Printing SampleBook.xlsx");
// Print the sheet.
try
{
sr.ToPrinter(printerName);
Console.WriteLine("Pinting finished.");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Error: ‘SheetRender’ does not contain a definition for ‘ToPrinter’ and no accessible extension method ‘ToPrinter’ accepting a first argument of type ‘SheetRender’ could be found (are you missing a using directive or an assembly reference?)
@Sudrashya
We think you are using the version of our component with SkiaSharp as graphics library in non-Windows system. For this graphics library, currently we do not support printer related features. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNET-52886
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Before we implement this feature, if possible please use the “for windows” version of our component which uses System.Drawing as the graphic library.
Hello johnson,
Thanks for reply. We are migrating application from .NET 4.8 to .NET 6 and .NET 6 does not support System.Drawing dll. Is there any other way to use the functionality in .NET 6 web application?
OR what is the estimated time to implement the feature?
@Sudrashya,
If you want to use Aspose.Cells library with SkiaSharp graphics library instead of System.Drawing on non windows os, you have to wait until we support the printing feature using SkiaSharp graphical assembly. We will also check if we could provide a rough estimate at the moment.
But if you are using Windows os, you should use System.Drawing graphical library which fully supports printing features in SheetRender API. See the document on how to use/run Aspose.Cells for .NET6.0 on Windows and non-Windows OS for your complete reference.