Custom Document Properties

 while (document.CustomDocumentProperties.Count > 0)
                document.CustomDocumentProperties.Remove(document.CustomDocumentProperties[0].Name);
document.Save("test.docx");

Why this does not work?
I see still CustomDocumentProperties in Word https://i.imgur.com/Vx2TehL.png even after running this. I breakpointed it and it looks like it is removing what is Word showing, but at end, nothing is removed. 16.2.0.46 is my version of Syncfusion. I am so confused.
What I am doing wrong? I want to remove them all, "Clean the file" from them.

//EDIT
When I run my app again, it shows document.CustomDocumentProperties.Count as 0. Is this a bug?

//EDIT 2

https://i.imgur.com/20DXfIm.png It is inside customXML folder in DOCX document... Why it was not removed? Why only MS Word on Windows sees it?

3 Replies

DB Dilli Babu Nandha Gopal Syncfusion Team August 17, 2018 03:03 PM UTC

Hi Richard, 

We tried to reproduce the reported issue from our side and unable to reproduce it. We suspect the issue might be document specific i.e., elements in the Word document. So, kindly share us the issue causing Word document which will helpful for us to provide you a prompt solution at the earliest. 

Regards, 
Dilli babu. 



RT Richard Torhan August 17, 2018 03:29 PM UTC

https://transfer.sh/UxcB6/qqq%20-%20Copy.docx

Here is the file. I can see additional custom properties in XML file on Windows MS Word 2016.


DB Dilli Babu Nandha Gopal Syncfusion Team August 20, 2018 11:40 AM UTC

Hi Richard, 

Thank you for your update. 

We have tried to reproduce the reported problem using the given details, but it works properly at our end. For your reference, we have prepared a sample application to remove the custom document properties as per your requirement.

Please find the sample from the below link: http://www.syncfusion.com/downloads/support/forum/139319/ze/GenerateWord1381171615.zip

Note: Please find the input Word document in the “Data” folder of above sample application.

In this sample we have done the following things:
1. Loads an existing Word document with custom document properties.
2. Removes the custom document properties.
3. Saves the Word document.

Kindly run the above sample application and then open the generated Word document using Microsoft Word application. The input Word document (in “Data” folder) contains custom document properties but, that custom document properties are removed in the resultant Word document as per your requirement. To check custom document properties please go to File->Properties ->Advanced Properties -> Custom tab in Microsoft Word application.

On further analyzing the given Word document (“qqq - Copy.docx”), we have not found custom properties when opening Word document using DocIO and also using Microsoft Word application. So, could you please provide us the modified sample of above along with the input Word document to reproduce the exact problem. Thereby, we will analyze further on the reported problem and provide you the appropriate solution at the earliest. 
 
Regards, 
Dilli babu. 


Loader.
Up arrow icon