none
How to get the BuiltInDocumentProperties? RRS feed

  • Question

  • I created a document in Word 2016 on PC.  I went to the File|Info menu item.  I saw the Properties on the right and changed the Title.  Then I tried to get the properties, but they all seem to return empty lists.

    Here is the code (in RemObjects Oxygene language):

       method WordWindow.Setfilename(value: String);
          var 
             objFilename : Object;
             doc         : Document;
             &readonly   : Object := false;
             isVisible   : Object := true;
             missingParm : Object := Missing.Value;
    
             DocProps    : Microsoft.Office.Core.DocumentProperties;
    
       begin
          ffilename   := value;
          objFilename := ffilename;
    
          if wordapp <> nil then begin
             wordapp.Quit;
             wordapp:= nil;
          end;
    
          wordapp := new ApplicationClass;
          wordapp:Visible := true;
          doc := wordapp:Documents:Open( 
          var objFilename, 
          var missingParm, 
          var &readonly, 
          var missingParm, 
          var missingParm, 
          var missingParm, 
          var missingParm, 
          var missingParm, 
          var missingParm, 
          var missingParm, 
          var missingParm, 
          var isVisible,
          var missingParm, 
          var missingParm, 
          var missingParm, 
          var missingParm 
          );
    
          if doc = nil then exit;
    
          var Attrs := new List<Attribute>;
    
          for each prop : DocumentProperty in DocumentProperties( doc.CustomDocumentProperties ) do begin
             Attrs.Add( new Attribute( Name := prop.Name, Value := prop.Value:ToString ) );
             end;
          for each prop : DocumentProperty in DocumentProperties( doc.BuiltInDocumentProperties ) do begin
             Attrs.Add( new Attribute( Name := prop.Name, Value := prop.Value:ToString ) );
             end;
          Attributes := Attrs; // to trigger the change in the property to force refresh of datagrid bound to it
          end;

    Both of the document properties fields of doc are empty.  Where is the Title I entered in Word?  Am I doing something wrong here?


    • Edited by Mark Tiede Saturday, July 7, 2018 11:26 AM
    Saturday, July 7, 2018 11:25 AM

All replies

  • Hello Mark Tiede,

    >>Both of the document properties fields of doc are empty

    What do you mean both document properties fields are empty? Sorry for my little knowledge with RemObjects Oxygene, what's the attribute? Did you fail to execute any "Attrs.Add"? Have you checked the return value of doc.BuiltInDocumentProperties.Count?

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 9, 2018 2:16 AM