Free Support Forum - aspose.com

REmove document properties not working

Hi,

I have a Visio diagram. It contains some ‘Document’ . We tried to remove document personal information (Like Author, CreatedTime, Modified date), document properties pro-grammatically. But the info not removed from the document.
Input: Visio Doc.zip (2.8 MB)

Output: Visio Doc_20200716194652_out.zip (1.4 MB)

Code:

public void VisioToDocx(string strInputFile, string strOutputPath)
{
FileStream _licenseStream = LicenseStream(out License licDiagram, out Aspose.Cells.License licCell);
FileStream st = new FileStream(strInputFile, FileMode.Open);
Diagram vsdDiagram = new Diagram(st);
st.Close();

        List<Shape> shapes = new List<Shape>();

        foreach (Page diagramPage in vsdDiagram.Pages)
        {
            foreach (Shape OLE_Shape in diagramPage.Shapes)
            {
                AddDocShapes(OLE_Shape, shapes);
            }
        }

        foreach (Shape shape in shapes)
        {
            Document doc = new Aspose.Words.Document(new MemoryStream(shape.ForeignData.Value));

            Aspose.Words.Saving.OoxmlSaveOptions options = new Aspose.Words.Saving.OoxmlSaveOptions();
            options.SaveFormat = Aspose.Words.SaveFormat.Docx;
            doc.BuiltInDocumentProperties.Clear();
            doc.CustomDocumentProperties.Clear();

            using (MemoryStream stream = new MemoryStream())
            {
                doc.Save(stream, Aspose.Words.SaveFormat.Docx);
                stream.Position = 0;
                shape.ForeignData.ObjectData= stream.ToArray();

            }
        }

        vsdDiagram.Save(strOutputPath + $"{Path.GetFileNameWithoutExtension(strInputFile)}_{DateTime.Now.ToString("yyyyMMddHHmmss")}_out.vsdx", SaveFileFormat.VSDX);

        ImageSaveOptions opt = new ImageSaveOptions(SaveFileFormat.PNG)
        {
            SmoothingMode = SmoothingMode.HighQuality,
            CompositingQuality = CompositingQuality.HighQuality,
            InterpolationMode = InterpolationMode.HighQualityBicubic,
            PixelOffsetMode = PixelOffsetMode.HighQuality,
            EnlargePage = false,
            Resolution = 96,
            PageIndex = 0
        };
        vsdDiagram.Save(strOutputPath + $"{Path.GetFileNameWithoutExtension(strInputFile)}_{DateTime.Now.ToString("yyyyMMddHHmmss")}_out.png", opt);
        _licenseStream.Close();

    }

Output image: image.png (31.8 KB)

We are waiting for your support and reply.

Thanks.

@msindia

We have logged an issue as DIAGRAMNET-51885 in our issue tracking system and will furher look into its details. We will inform you as soon as we have some updates about its resolution. Please spare us some time.

We are sorry for the inconvenience.

@asad.ali,

This like ’ this ticket ‘Remove excel personal information using aspose diagram
please support us.

Thanks

@msindia

We have re-investigated the ticket and could not find this issue using Aspose.Words with version 20.6 and Aspose.Diagram 20.7.

Also,this issue is not related to Aspose.Diagram. Please Remove document properties using Aspose.Words only and get the doc in visio using this code:

Aspose.Words.Saving.OoxmlSaveOptions options1 = new Aspose.Words.Saving.OoxmlSaveOptions();
options1.SaveFormat = Aspose.Words.SaveFormat.Docx;
doc1.BuiltInDocumentProperties.Clear();
doc1.CustomDocumentProperties.Clear();

doc1.Save(Constants.destPath + "out.docx",options1); 
1 Like