Dhananjay
2009-05-28 13:43:40 UTC
Hi All,
I am developing word Addin using VB 2005 / VSTO / Office 2007.
I want to write some CustomDocumentProperties to the document. So I
used the code snippet below
-----------------------------------------------------------
doc = Application.ActiveDocument
Dim myProperties(,) As String = {{"ID", "ID1"}, {"NAME",
"Name1"}}
prps = doc.CustomDocumentProperties
For i As Int16 = 0 To myProperties.GetUpperBound(0)
prps.Add(myProperties(i, 0), False,
Microsoft.Office.Core.MsoDocProperties.msoPropertyTypeString,
myProperties(i, 1))
Next
doc.Save ' Save as File.Docx
' Copy File from doc.FullName to some other folder
dim myFolder = "c:\temp\"
File.Copy doc.FullName,myFolder
' Open document from myFolder
dim myTempDoc as Document = Application.Documents.Open
(myFolder & "File.docx")
myTempDoc.CustomDocumentProperties("Name").value= "Name
changed"
myTempDoc.Save
myTempDoc.Close
-----------------------------------------------------------
But when I open myTempDoc again, it shows me value for Name & ID as
"Name1" & "ID1"
Please help me to resolve this problem.
Thanks in advance,
Dhananjay
I am developing word Addin using VB 2005 / VSTO / Office 2007.
I want to write some CustomDocumentProperties to the document. So I
used the code snippet below
-----------------------------------------------------------
doc = Application.ActiveDocument
Dim myProperties(,) As String = {{"ID", "ID1"}, {"NAME",
"Name1"}}
prps = doc.CustomDocumentProperties
For i As Int16 = 0 To myProperties.GetUpperBound(0)
prps.Add(myProperties(i, 0), False,
Microsoft.Office.Core.MsoDocProperties.msoPropertyTypeString,
myProperties(i, 1))
Next
doc.Save ' Save as File.Docx
' Copy File from doc.FullName to some other folder
dim myFolder = "c:\temp\"
File.Copy doc.FullName,myFolder
' Open document from myFolder
dim myTempDoc as Document = Application.Documents.Open
(myFolder & "File.docx")
myTempDoc.CustomDocumentProperties("Name").value= "Name
changed"
myTempDoc.Save
myTempDoc.Close
-----------------------------------------------------------
But when I open myTempDoc again, it shows me value for Name & ID as
"Name1" & "ID1"
Please help me to resolve this problem.
Thanks in advance,
Dhananjay