Convert doc to docx from visio file (Old version to latest version)

Hi,
We have visio file and that file have ‘.doc’ file. So we collect the ‘.doc’ shapes then save to ‘.docx’. FInally save the Visio file, Still the documnet shown ‘.doc’ format.

Input: Visio Doc.zip (2.8 MB)

Code:
[TestMethod]
public void TestVisioDocument()
{
using(FileStream _licenseStream = LicenseStream(out License licDiagram, out Aspose.Cells.License licCell))
{
string[] files = Directory.GetFiles(@“C:\Users\input”, “*.vsdx”);
foreach(string file in files)
{
Diagram diagram = new Diagram(file, LoadFileFormat.VSDX);

                foreach(Page diagramPage in diagram.Pages)
                {
                    foreach(Shape OLE_Shape in diagramPage.Shapes)
                    {
                        if(OLE_Shape.Type == TypeValue.Foreign)
                        {
                            if(OLE_Shape.ForeignData.ForeignType != ForeignType.Object) continue;
                            if(OLE_Shape.ForeignData.ObjectData == null) continue;
                            Stream Ole_stream = new MemoryStream(OLE_Shape.ForeignData.Value);
                            // Get format of the OLE file object
                            Aspose.Words.FileFormatInfo info = Aspose.Words.FileFormatUtil.DetectFileFormat(Ole_stream);
                            if(info.LoadFormat == Aspose.Words.LoadFormat.Doc || info.LoadFormat == Aspose.Words.LoadFormat.Docx)
                            {
                                // Modify an OLE object
                                Document doc = new Document(new MemoryStream(OLE_Shape.ForeignData.Value));

                                Aspose.Words.Saving.OoxmlSaveOptions options = new Aspose.Words.Saving.OoxmlSaveOptions();
                                options.SaveFormat = Aspose.Words.SaveFormat.Docx;

                                using(MemoryStream stream = new MemoryStream())
                                {
                                    doc.Save(stream, options);
                                    OLE_Shape.ForeignData.Value = stream.ToArray();

                                }

                            }
                        }
                    }

                    // Save Visio diagram
                    diagram.Save($"C:\\UsersDirectExcel\\{Path.GetFileNameWithoutExtension(file)}out{DateTime.Now.ToString("yyyyMMddHHmmss")}.vsdx", SaveFileFormat.VSDX);
                }
            }
        }
    }

Waiting for your support and reply.

Thanks

@msindia

Would you kindly share a screenshot of the issue that you are mentioning. We have tested the scenario in our environment using Aspose.Diagram for .NET 20.6 and noticed another issue that document object was not showing in the output VSDX. Would you kindly share your feedback so that we can further proceed accordingly.

@asad.ali.

We have the same problem ( the document object was not showing in the output VSDX). But our requirement is convert Embedded .‘doc’ to ‘.docx’.

Thanks.

@msindia

We have logged an issue as DIAGRAMNET-51858 in our issue tracking system for further investigation. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

@asad.ali,

We hope your working on this ticket . If there is any update let us know.

Please give trail version if you resolved the issue.
We are waiting for your support and reply.

Thanks.

@msindia

We would like to share with you that earlier ticket is resolved in upcoming version of the API i.e. 20.7. We will inform you as soon as the fix is available.

@msindia

We would like to share with you that your issue has been resolved in Aspose.Diagram for .NET 20.6.1 hotfix.

The issues you have found earlier (filed as DIAGRAMNET-51858) have been fixed in Aspose.Diagram for .NET 20.7.

@asad.ali,

This ‘DIAGRAMNET-51858’ ticket is resolved.

Thanks