The ole object of visio display incorrect


I have two question:
1. the old object of visio display is like below
图片.png (10.9 KB)

I expect see the visio content, but see a aspose image. when I double click, it can edit as visio.

  1. Can I change the display text of embeded excel file display text?
    图片.png (1.0 KB)

it always display Microsoft Excel Worksheet, no matter i insert it as file or stream. but in word, it can display file or other text, how can i do it use aspose?


the display format is incorrect of the page:
图片.png (1.8 KB)


Thanks for your inquiry. A simple solution would be to just simplify the Visio file using Aspose.Diagram for .NET to the content that you want to be visible in Word document and then insert it as embedded object in Word document using DocumentBuilder.InsertOleObject method of Aspose.Words for .NET as follows:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape obj = builder.InsertOleObject(MyDir + "v1.vsd", false, true, Image.FromFile(MyDir + "v1.jpg"));
obj.Width = 4 * 72;
obj.Height = 4 * 72;
doc.Save(MyDir + @"16.7.0.docx");

Aspose.Diagram for .NET supports converting Visio to images. A simple solution would be to just convert Visio to image and then use that preview image in DocumentBuilder.InsertOleObject method as above (vi.jpg):

Diagram diagram = new Diagram(@"C:\temp\\v1.vsd");
diagram.Save(@"C:\temp\v1.jpg", SaveFileFormat.JPEG);

Hope, this helps.

Best regards,
Awais Hafeez


Is there other options to get the preview image? I only have licence of visio and word.


oops, sorry, I have the license of Diagram. I will try your solution.

what about the second question.
How to change the display text of excel attachment


there is an exception when I save my viso file to image: #black is not a valid value for Int32.
it seems to say there is an #black in my visio that cannot be parsed, but i cannot find #black in the visio file
the visio file: please change the zip to vsdx to view (1.3 MB)

We changed the extension from Zip to VSDX, but the file becomes corrupted. Please archive the original VSDX drawing, and then send us again. We will investigate and share our findings with you. Your response is awaited.

We are gathering details and will reply to your second question as well.

Best Regards,
Imran Rafique


The same above approach (as narrated by our colleague Awais) can be used to embed an Excel file in the Word document. You can use Aspose.Cells for .NET API to convert a worksheet to an image. Please refer to this help topic: Converting Worksheet to Image.

Please let us know in case of any further assistance or questions.

Best Regards,
Imran Rafique


the zipped visio file: (1.1 MB)

may you misunderstood my second question, or i misunderstood your answer. i want to show a icon for excel attachment, it's work well, but i don't know how to change the caption of the attachment, please check the image bellow to see the difference, the first one is inserted by aspose, it's caption is always be "Microsoft Work Sheet"; the second is copy a file and past into microsoft word, it's caption is the filename; the third is the same file with the second, it is inserted by insert object dialog of microsoft word, and i changed the icon caption when inserting.

I want to know how to achieve the effect of the third, if it cannot, the second is acceptable.

图片.png (1.6 KB)

#10 ,

Thanks for your inquiry.

We have logged your requirement in our issue tracking system. The ID of this issue is WORDSNET-15582. Our product team will further look into the details of this problem and we will keep you updated on the status of this issue. We apologize for any inconvenience.

As a workaround, you can generate an icon image with custom caption text and pass that image to InsertOleObject method:

builder.InsertOleObject(MyDir + "Book1.xlsx", false, true, Image.FromFile(MyDir + "custom-image.jpg"));

Best regards,
Awais Hafeez



I will try it.


what about the exception when save visio to image? i attached the zipped visio file before


the attachment is the zipped visio file, which cause aspose exception when save as png image: (1.1 MB)


We managed to replicate this error in our environment. It has been logged under the ticket ID DIAGRAMNET-51288 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates. We are sorry for the inconvenience caused.

Best Regards,
Imran Rafique


ok, thanks a lot

The ticket ID DIAGRAMNET-51288 has been resolved. If there is no issue in the quality assurance phase, then this fix will be included in the next version 17.7 of Aspose.Diagram for .NET API. We will notify you as soon as the new release is published.

Best Regards,
Imran Rafique


The issues you have found earlier (filed as DIAGRAMNET-51288) have been fixed in Aspose.Diagram for .NET 17.7. This message was posted using BugNotificationTool from Downloads module by imran.rafique



i got aspose.diagram 17.7, and saved an image for my visio, but i feel that the result image is unacceptable, there are too much differences between them.
the screenshot of visio:
图片.png (113.4 KB)

the screenshot of saved image:
图片.png (148.2 KB)

my code:
Diagram diagram = new Diagram(“D:\1.vsdx”);
diagram.Save(“D:\1.png”, SaveFileFormat.PNG);

We managed to replicate the problem of the lower quality image. It has been logged under the ticket ID DIAGRAMNET-51311 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

Best Regards,
Imran Rafique