How to open Doc file and manipulate document Properties

0 Answers 25 Views
WordsProcessing
Warren
Top achievements
Rank 1
Warren asked on 05 May 2022, 04:24 PM
We are looking to update our application from ASP.Net to Blazor.  We also use a windows application for the Microsoft.Office.Interop functionality to manipulate word Doc files and add custom properties to them.  Is there a way with the Document Processing tools to be able to recreate this process in our Blazor application?  We would like to sunset the windows application if possible.
Tanya
Telerik team
commented on 09 May 2022, 01:11 PM

Hi Warren,

Could you please provide more details on the custom properties you need to set? How do you set them in Microsoft.Office.Interop? I would like to ensure I am properly understanding the scenario so I can provide you with the most accurate information about it. Any additional details you can share will be appreciated.

Warren
Top achievements
Rank 1
commented on 09 May 2022, 01:36 PM

We define custom propertiesas an object and set it to the CustomDocumentProperties:

oDoc As Microsoft.Office.Interop.Word.Document

Dim oCustomProps As Object
oCustomProps = oDoc.CustomDocumentProperties

oCustomProps.Add("IntagrasScrubbed", False, Microsoft.Office.Core.MsoDocProperties.msoPropertyTypeString, "YES")

We do this for several properties and then save:

oDoc.UpdateSummaryProperties()
oDoc.Save()

We track all the changes and then save the document to a wordml version so we can parse the xml and extract the data we use.

oDoc.SaveAs(wordmlfilenamepath, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatXML)
oDoc.Close(False)

Currently we have a windows application to process the word document and a web application to manipulate the data and the rest of our process.  We would like to only have one application moving forward, but need to be able to manipulate word docs to accomplish this.

Tanya
Telerik team
commented on 11 May 2022, 10:51 AM

Hi Warren,

Thank you for the additional information.

Do you think that the Document Variables would be a suitable place to store the needed data? The custom document properties are currently not supported in WordsProcessing and we have logged a request about this functionality: WordsProcessing: Add support for custom document properties. You can use this item to vote for the implementation of the task and follow it if you would like to receive notifications about status changes on it.

Hope this is helpful.

No answers yet. Maybe you can help?

Tags
WordsProcessing
Asked by
Warren
Top achievements
Rank 1
Share this question
or