Wrong preview picture on OLE Objects

Hi,

I'm inserted an Excel File in a Word Document with DocIo. Here's my Code:
File.WriteAllBytes(tempfile, excelStream);

ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;

application.ChartToImageConverter = new ChartToImageConverter();
application.ChartToImageConverter.ScalingMode = Syncfusion.XlsIO.ScalingMode.Best;

IWorkbook workbook = application.Workbooks.Open(tempfile, ExcelOpenType.Automatic, ExcelParseOptions.Default);
WPicture picture = new WPicture(document);
IWorksheet sheet = workbook.ActiveSheet;

picture.LoadImage(sheet.ConvertToImage(1, 1, sheet.UsedRange.LastRow, sheet.UsedRange.LastColumn));
var scale = 520 / picture.Width * 100;
picture.WidthScale = scale;
picture.HeightScale = scale;

WOleObject oleObject = selection.GetAsOneRange().OwnerParagraph.AppendOleObject(tempfile, picture, Syncfusion.DocIO.DLS.OleObjectType.ExcelWorksheet);
oleObject.DisplayAsIcon = false;
File.Delete(tempfile);

The problem is that the colors of the charts are wrong and there is a black rectangle in the top. What went wrong???

See my screens below.

Kind regards,
Carsten

Here is how it looks like in Excel:


Here is a screen in Word:

And here how it looks like, if I insert it direct in Word:



7 Replies

SR Suganya Rathinam Syncfusion Team February 5, 2018 12:50 PM UTC

Hi Carsten,

Thank you for using Syncfusion products.

We have tried the given code snippet and are unable to reproduce the issue at our end. So, we kindly request you to share us the input Excel file and Word document to investigate further on this issue and provide a prompt solution at the earliest.

Regards,
Suganya R
 



CB Carsten Buchmann February 5, 2018 01:48 PM UTC

Excel File:
https://systmanu.sharepoint.com/:x:/g/Projects/ETHsUrhJOlBFgvKQjuj-IDQBI32jjfFbOvBUdGcJTSkaig

Word File (Page 13):
https://systmanu.sharepoint.com/:w:/g/Projects/EfwqfeXPfEVIk1uKvfiFB9oBAfWbBgh3siJKYtPsyAvtcg

Now I'm missing completly the charts.


MM Mathu Mohan Vijayakumar Syncfusion Team February 6, 2018 04:52 PM UTC

Hi Carsten, 
 We have validated the issue in the shared Excel file and found that the chart colors are referred from the style IDs. Currently XlsIO do not have support for “Color and size properties to be referenced from styles IDs in the document”. We have logged the feature request for this in our database, which will be implemented in our any of the upcoming releases. 
Regarding a black rectangle in the top: 
We are able to reproduce the issue with “Shape border color is incorrect in worksheet to image conversion” and the fix for the issue will be included in our upcoming release 16.1 service pack 1, which is expected to be rolled out in March 2018. 
Regards, 
Mathu Mohan V A 



CB Carsten Buchmann February 7, 2018 10:36 AM UTC

Do you got a workaround for us? Can I modify the excel to get it work?


And by the way we got a similiar problem with the Image Conversion in the Presentation. 
Left Powerpoint / Right Image



MM Mathu Mohan Vijayakumar Syncfusion Team February 8, 2018 06:02 PM UTC

Hi Carsten,  
  
Thank you for updating us. 
  
Please find the details below. 
  
Query#1: Do you got a workaround for us? Can I modify the excel to get it work? 
Yes. By modifying the Excel document you can preserve the chart colors in image conversion.  
  
Workaround Details: 
We kindly request you to change the series fill color from automatic to expected color in the document. The changes has been described in the below images. 
  
Existing Fill Options in the Excel file 
(To Do) Modified the Fill Options in the Excel file 
 
  
 
  
Query#2: And by the way we got a similiar problem with the Image Conversion in the Presentation.  
We are unable to reproduce the issue at our end. So, we kindly request you to share us the input Presentation document to investigate further on this issue and provide a prompt solution at the earliest. 
  
Regards,  
Mathu Mohan V A  



CB Carsten Buchmann April 17, 2018 08:52 AM UTC

Hi,

after updating the project to 16.1.0.32 we got an ArgumentOutOfRangeException in PresentationCore.dll while using the method ConvertToImage. (see screenshots)

Is it a bug or do we make something wrong?

Kind regards,
Carsten



AV Abirami Varadharajan Syncfusion Team April 19, 2018 03:38 PM UTC

Hi Carsten, 
 
We are able to reproduce issue with “Argument Exception is raised on chart to image converter in different culture” and logged a defect report. We will include the fix in our upcoming service pack release 16.1 SP – 2 which will be available by end of April 2018. 
 
Please let us know if you have any concerns. 
 
Regards, 
Abirami 


Loader.
Up arrow icon