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

Free Support Forum - aspose.com

Output distorted when converting excel to pdf using Aspose.Cell(20.4.0)

We have noticed that when we are converting excel to pdf using Aspose.Cell (20.4.0) then transparent marker points in the excel file are getting distorted in Pdf.

Reproducer:-

    static void pdfConversion()
		{
			var workbookStream = new FileStream("ExcelFdsChart.xlsx", FileMode.Open);
			var workbook = new Workbook(workbookStream);
			var saveOptions = new PdfSaveOptions() {  };
			workbook.Save(@"ExcelFdsChart.pdf", saveOptions);
		}

Please find the attachment for required file.

ExcelFdsChart.zip (168.8 KB)
ExcelFdsChart.pdf (121.7 KB)

MarkingCircleOnMarker.JPG (44.7 KB)

@dfactset,

Thanks for the template file, sample code segment, output PDF and screenshot.

After an initial test, I am able to reproduce the issue as you mentioned. When converting Excel file to PDF using Aspose.Cells v20.4.x, the transparent marker points in the Excel file are getting distorted in the output PDF file format. I have logged a ticket with an id “CELLSNET-47360” for your issue. We will look into it soon.

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

@dfactset,
Please try the following code, the output will be OK.

Workbook wb = new Workbook("ExcelFdsChart.xlsx");

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();

pdfSaveOptions.EmfRenderSetting = EmfRenderSetting.EmfPlusPrefer;

wb.Save("output.pdf", pdfSaveOptions);

Set EmfRenderSetting.EmfPlusPrefer , it will prefer to use EmfPlus records while parsering Emf image file.

Thank you @ahsaniqbalsidiqui

Solution suggested by you is working fine for me.

@dfactset,

Good to know that the suggested solution works fine for your needs. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Hi @Amjad_Sahi

After setting EmfRenderSetting to EmfRenderSetting.EmfPlusPrefer, our old issue has been fixed.
But because of this setting we have got another issue where pdf is ignoring the chart background.

Reproducer:-

static void pdfConversion()
        {
            var workbookStream = new FileStream("InputExcel.xlsx", FileMode.Open);
            var workbook = new Workbook(workbookStream);
            var saveOptions = new PdfSaveOptions() {  };
            saveOptions.EmfRenderSetting = EmfRenderSetting.EmfPlusPrefer;
            workbook.Save(@"OutputPdf.pdf", saveOptions);
        }

Please find the attachment for required file.

InputExcel.zip (234.7 KB)
OutputPdf.zip (216.6 KB)

We want both issue to work fine. Can you please suggest the solution which will work in both case.

@dfactset,

Thanks for the test case with template file and output file.

You are right. I reproduced the issue as you mentioned via your newly attached file with your sample code. I found the object’s background is ignored/off in the output PDF file. By the way, if we do not set EMF plus prefer rendering setting it works fine. Anyways, I have reopened your issue “CELLSNET-47360” and we will look into it soon.

@dfactset,

We found the chart background in GdiPlus records is filling a rectangle with a Texture brush. Currently, the Texture brush is not handled well in the APIs. It is a complex task that demands time to fix it completely. We are afraid, currently we have certain priority issues and tasks for enterprise support section. The initial plan for this issue (to be fixed) is Q4, 2020.

@dfactset,

Please try our latest version/fix: Aspose.Cells for .NET v20.8.1 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells20.8.1 For .Net2_AuthenticodeSigned.Zip (5.4 MB)
Aspose.Cells20.8.1 For .Net4.0.Zip (5.4 MB)

@Amjad_Sahi,

I tried with the latest version/fix: Aspose.Cells for .NET v20.8.1 (attached). Both scenarios mentioned above working fine.

Please let me know when this version will be released as nuget package.

@dfactset,

Thanks for your feedback.

Good to know that your issue is sorted out by the new fix.

We publish only official releases to Nuget repos. once in a month. Our next official release, i.e., Aspose.Cells for .NET v20.9 will be published (both on Downloads and nuget repos.) in the third week of September, 2020. You will be notified here once we publishes the release.

The issues you have found earlier (filed as CELLSNET-47360) have been fixed in Aspose.Cells for .NET v20.9. This message was posted using Bugs notification tool by Amjad_Sahi
You may also get the new version @ nuget repos. (https://www.nuget.org/packages/Aspose.Cells/20.9.0)