We are using Aspose.Cell (dll Version 8.9.2.0) for printing Excel to PDF through Aspose.
Issue :
Aspose is not printing properly
Operating System : Windows 10
Screen Resolution : 1920 * 1080 (Recommended resolution)
Apart from any other resolution it is not working out(Even Microsoft Recommended Resolution also)
1024 * 768
1360 * 768
1366 * 768
How can we avoid the content spill over from system to system (different screen resolution). We verified that Microsoft interop dll and print to PDF of MS Excel prints data perfectly.
Could you please share the code to avoid content spill over?
Below I have attached the code and Excel document I used for PDF conversation.
Please let us know if more details required. It will be great if your share the resolution soon.
Attached sample for reproduced issue Samples.zip (36.9 KB)
Here is the sample code we are used for converting
public void ConvertExcelWorkbookToPDF(SpreadsheetGear.IWorkbook wb, string destinationFile, SpreadsheetGear.FileFormat f = SpreadsheetGear.FileFormat.OpenXMLWorkbook)
{
MemoryStream ms = new MemoryStream();
wb.SanitizeWorkbookEx();
wb.SaveToStreamEx(ref ms, f);
Aspose.Cells.Workbook wb1 = new Aspose.Cells.Workbook(ms, new Aspose.Cells.LoadOptions(Aspose.Cells.LoadFormat.Auto));
AutoFitterOptions oAutoFitterOptions = new AutoFitterOptions { AutoFitMergedCells = true, OnlyAuto = false };
foreach (Aspose.Cells.Worksheet ws in wb1.Worksheets)
{
ws.AutoFitRow(0, 0, 0, oAutoFitterOptions);
ws.AutoFitRows(true);
}
Aspose.Cells.PdfSaveOptions pso = new Aspose.Cells.PdfSaveOptions();
pso.DefaultFont = "Calibri";
wb1.Save(destinationFile, pso);
ms.CloseEx();
}
Please also see the following screenshot. Its resolution is 1920x1080. I tested the issue in this resolution and took the screenshot. Please download the output Pdf for your reference.
Please check if your display setting is set to 100%, 125% or 150% as shown in this screenshot. If it is set to non-100%, set it back to 100% and it should fix your issue. It is best option.
In case, you do not want to set it to 100%, then set CellsHelper.DPI = 96 before you execute your code. And it should also solve your issue.
I have tried adding above code in both before setting licence and after setting licence in App.xaml.cs this is the starting point of my wpf application .
I think something around this DPI settings , at some point it will change the DPI but it won’t next time
Try to change DPI to 96 and 120 several time using code
Also checked in version 17.12.8 you provided seems same issue in that .
Same issue for reference
Please provide us your simplified test project utilizing the DPI settings. It will help us look into this issue further. Thanks for your help in this regard.
TestDPI.zip (20.5 KB)
I have attached a code for setting and printing DPI value
please refer Aspose.Cells.dll 8.9.2.0 version in that project as this app won’t support more than 3MB file upload
Please let me know if you required anything more from me
We are progressing with testing and so far good , tested in two machine and working fine . i will let you know if anything comes up.
Thanks for your effort to solve this issue
It is good to know that initial testing yielded good results. Let us know if you encounter any other issue, we will be glad to look into it and help you further.