Rendering issues when saving as PDF

The attached files demonstrate some issues that occur when saving an excel document as PDF.

There are three files attached :-

  1. ShapeFormatting.xlsx
  • (Source document)

  • ShapeFormatting(ExcelToPDF).pdf
    • (Document saved as PDF from Excel 2013)

  • ShapeFormatting(AsposeToPDF).pdf
    • (Document as converted by AsposeCELLS.NET, v8.2.1.0)

    The highlighted issues are :-
    • Drop shadows on the shapes are lost
    • Images which are grouped with other shapes are rendered at an incredibly low resolution
      • Compare the rendered output between the un-grouped image (left), and the grouped image (right) in the attached PDF, both images are the same resolution in the excel document and in the PDF saved from Excel 2013.

    The following code was used to convert the file.

    namespace AsposeTest {
    	class Program {
    		static void Main(string[] args) {
    			try {
    
    			<span class="type">var</span> openBook = <span class="keyword">new</span> Aspose.Cells<span class="type">Workbook</span>(<span class="string">"ShapeFormatting.xlsx"</span>);
    
    			<span class="type">var</span> opt = <span class="keyword">new</span> Aspose.Cells<span class="type">PdfSaveOptions</span>(Aspose.Cells.SaveFormat.Pdf) {
    				PrintingPageType = Aspose.Cells.PrintingPageType.IgnoreBlank,
    				CheckFontCompatibility = <span class="keyword">true</span>
    			};
    
    			opt.SetImageResample(600, 99);
    
    			openBook.Save(<span class="string">"ShapeFormatting(AsposeToPDF).pdf"</span>, opt);
    
    		} <span class="keyword">catch</span> (<span class="type">Exception</span> ex) {
    			<span class="type">Console</span>.<span class="type">Out</span>.WriteLine(ex.ToString());
    		}
    	}
    }
    

    }<!–[if IE]>

    <![endif]–>



    .csharpcode, .csharpcode pre { font-size: 13.3333px; font-width: 400; color: black; font-family: "Courier New"; } .csharpcode pre { margin: 0px; } .csharpcode .comment { color: #008000; } .csharpcode .comment2 { color: #808080; } .csharpcode .type { color: #2B91AF; } .csharpcode .keyword { color: #0000FF; } .csharpcode .string { color: #A31515; } .csharpcode .preproc { color: #0000FF; }

    Hi James,


    Thank you for contacting Aspose support.

    We have evaluated your presented scenarios while using the latest version of Aspose.Cells for .NET 8.2.1.1, and we are able to replicate all the problems as mentioned in your post. We have logged these problems in our bug tracking system for further investigation & correction purposes. The details of the logged tickets are as follow.

    1. CELLSNET-43029: Shape drop shadows lost
    2. CELLSNET-43030: Grouped shapes are rendered with low quality
    3. CELLSNET-43031: Background shape is not rendered

    In reference to the CELLSNET-43031, there is a shape behind the Aspose logo that MS Excel renders properly. However, when rendered with Aspose.Cells, the background shape isn’t rendered at all. Please check the attached snapshot for your reference.

    Please spare us little time to properly analyze the problem cause for these issues. Once we have updates for your in this regard, we will post here for your kind reference.

    Hi James,


    Thank you for your patience with us.

    Just to bring in your knowledge that we are currently working on the issues to provide the fix with next release of Aspose.Cells for .NET API. One of the tickets (CELLSNET-43031) has been completely analyzed and the solution to render the background shape is to set the PdfSaveOptions.ImageType as ImageFormat.Png. Here is the complete code for your reference.

    C#

    var openBook = new Workbook(“D:/temp/ShapeFormatting.xlsx”);
    var opt = new PdfSaveOptions(Aspose.Cells.SaveFormat.Pdf)
    {
    PrintingPageType = Aspose.Cells.PrintingPageType.IgnoreBlank,
    CheckFontCompatibility = true,
    ImageType = ImageFormat.Png
    };
    opt.SetImageResample(600, 99);
    openBook.Save(“D:/temp/ShapeFormatting(AsposeToPDF).pdf”, opt);

    Hi again,


    This is to update you regarding the ticket logged earlier as CELLSNET-43030 (Grouped Shapes are Rendered with Low Quality as Compared to Un-Grouped Shapes). This problem requires a lot of work to re-design Aspose.Cells internal model to render grouped EMF images present in the spreadsheets. We will schedule the relevant tasks at earliest possible, however, you may workaround the situation by using the code snippet provided in our previous response. Please note, setting the PdfSaveOptions.ImageType to ImageFormat.Png will yield better results as compared to the PDF generated without specifying the PdfSaveOptions.ImageType.