Convet Visio to PNG the excel Image Borders missing

Hi,

I have visio file that file have ‘Excel’ , We collect the excel shapes and convert to png, place to the image instead of excel, then remove the excel shape. Then we shave the diagram to Png , The Image Right and bottom borders missing.
Input : Dialog - 28.zip (58.4 KB)

Output : Dialog - 28_20200514115233_out.png (16.7 KB)
Sample Code: VisioToExcel.zip (2.0 KB)

Note: Borders also not clear Right and Bottom
We are waiting for your support and reply.

Thanks.

@msindia

We have logged an issue as DIAGRAMNET-51837 in our issue tracking system for the sake for further investigation. We will surely inform you as soon as we have some definite updates regarding its resolution. Please spare us some time.

We are sorry for the inconvenience.

@asad.ali,

We have updated the question. please have a look. The image borders missing.

We are waiting for your reply.

Thanks.

@msindia

Would you please try to use .emf instead of .png then the output will be fine like below sample code:

Workbook workbook = new Workbook(new MemoryStream(shape.ForeignData.ObjectData));
ImageOrPrintOptions options = new ImageOrPrintOptions
{                                                  
OnePagePerSheet = true,                                                  
ImageType = ImageType.Emf,   ////emf instead of png                                                  OnlyArea = true,                                                  
IsCellAutoFit = true,                                                  
HorizontalResolution = 200,                                                  
VerticalResolution = 200                                              
};

object workSheet = workbook.Worksheets.OleSize;                
Regex regexMatch = new Regex("\\(.*?\\)");                
long id = 0;                
foreach(Worksheet worksheet in workbook.Worksheets)
{                    
if(!worksheet.IsSelected) continue;                    
worksheet.PageSetup.PrintArea = regexMatch.Match(workSheet.ToString()).ToString();

SheetRender sr = new SheetRender(worksheet, options);

sr.ToImage(0, strOutputPath + "/outputConvertWorksheettoImageFile.emf");   /////emf instead of png
// Render the sheet with respect to specified image/print options                    
using (FileStream fs = new FileStream(strOutputPath + "/outputConvertWorksheettoImageFile.emf", FileMode.OpenOrCreate, FileAccess.ReadWrite))
{                        
byte[] buff = new byte[fs.Length];                        
fs.Read(buff, 0, (int)fs.Length);

MemoryStream streamPng;                        
using (streamPng = new MemoryStream(buff))
{                            
double pinX = shape.XForm.PinX.Value;                           
 double pinY = shape.XForm.PinY.Value;                            
double width = shape.XForm.Width.Value;                            
double hieght = shape.XForm.Height.Value;                           
 id = vsdDiagram.Pages[0].AddShape(pinX, pinY, width, hieght, streamPng);                        }                    }                
}

@asad.ali,

We tried with your change and added with visio. We got the output like below.

Output: Dialog - 28 - Copy_20200521165210_out.png (8.8 KB)

Please help us. We are waiting for your reply.

Thanks

@msindia

We have logged your feedback along with the ticket and will let you know as soon as we have additional updates. Please spare us some time.

@asad.ali,

May I know the task status.

Thanks

@msindia

The ticket is currently under the phase of investigation. Would you please provide “outputConvertWorksheettoImageFile.emf” and the output .vsdx. Also, we are using the latest versions of the APIs for testing.

The output file and the code we used are attached.

tests.zip (7.1 KB)