A family of Microsoft word processing software products for creating web, email, and print documents.
Greg, you may want to take a look at WebGenii's posts in this thread on Eileen's Lounge.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have been tinkering with a template that Charles Kenyon posted:
Charles post Download: template
which that when opened creates fifty or sixty new entries to appear on the Insert>Text>Document Property menu. I know that this is a feature of SharePoint but I have managed to have some success achieving the same thing with just a text editor:
Here is my much compacted XML file content:
<?xml version="1.0"?>
<p:properties xmlns:p="http://schemas.microsoft.com/office/2006/metadata/properties" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserDefinedProperties>
<Age xmlns="https://TheAnchorage/UserDefinedProperties"/>
</UserDefinedProperties>
</p:properties>
Here is the much compacted .xsd file content:
<?xml version="1.0"?><ct:contentTypeSchema xmlns:ct="http://schemas.microsoft.com/office/2006/metadata/contentType" xmlns:ma="http://schemas.microsoft.com/office/2006/metadata/properties/metaAttributes">
<xsd:schema targetNamespace="http://schemas.microsoft.com/office/2006/metadata/properties" ma:root="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:p="http://schemas.microsoft.com/office/2006/metadata/properties" xmlns:ns2="https://TheAnchorage/UserDefinedProperties">
<xsd:import namespace="https://TheAnchorage/UserDefinedProperties"/>
<xsd:element name="properties">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="documentManagement">
<xsd:complexType>
<xsd:all>
<xsd:element ref="ns2:Age" minOccurs="0"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema targetNamespace="https://TheAnchorage/UserDefinedProperties" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dms="http://schemas.microsoft.com/office/2006/documentManagement/types">
<xsd:import namespace="http://schemas.microsoft.com/office/2006/documentManagement/types"/>
<xsd:element name="Age" nillable="true" ma:displayName="Client Age" ma:default="" ma:hidden="false" ma:internalName="Age" ma:readOnly="false">
<xsd:simpleType>
<xsd:restriction base="dms:Text">
<xsd:maxLength value="3"/>
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:schema>
</ct:contentTypeSchema>
When both are loaded, using the Word Developer>XML Mapping Pane>(Add new part..), I successfully add the parts.
The Insert>Text>Document Property menu is populated as expected:
Clicking on the custom menu item "Client age" inserts the mapped property as a content control in the document:
The mapped content is validate per the schema.
Here is the problem. I don't understand the underlying schema defined as "dms". It seems like I should be able to change the existing restriction base from dms:"Text" to dms:"integer" and the validation would require integers only.
I mean I know that from the W3 Schools page on schema restrictions that you can do all sorts of thing to validate e.g.,:
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
Does anyone have access to this dms schema to discover what is possible. Sorry, but I am really rather ignorant on schema, namespaces and the such and may have my terms mixed up. Thanks.
A family of Microsoft word processing software products for creating web, email, and print documents.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Greg, you may want to take a look at WebGenii's posts in this thread on Eileen's Lounge.
Charles,
That is just my made up namespace. I don't really understand all of that myself.
No. I toyed with that years ago:
https://gregmaxey.com/word\_tip\_pages/validate\_content\_control\_with\_schema.html
Back to the document you posted that puts all those items on the QuickParts menu. Somebody somewhere at some point developed a contentType schema that includes definitions for "Text, TimeDate, Number, Note, Currency, Unknown, Boolean, Choice, Lookup" among others. When base="dms:Text"> is used in the schema above the result is a plaintext CC is inserted in the document (same for Currency, Note, and Number), DateTime results in a Date CC, Choice as DropdownList CC.
What I don't know is if that schema has definitions to insert a RichText CC, ComboBox, Picture, or Checkbox CC. If it does, I don't know what I would put here: base="dms:???????" to make that work.
If that schema doesn't have definitions for those types mentioned above then I don't know if some smart guy or gal could edit it and create them? It seems like it should be possible, but I don't even know where that schema is or what it looks like (in whole).
I am just tinkering with the two CustomXMLParts that where part of that document you posted. I saved them as .xml and .xsd files and them just started weeding out stuff that made no sense (stabbing in the dark) and came up with the examples above.
A lot can be done with what we have but it would be nice if we could find a way to insert comboboxex, richtext, picture or checkboxes from those menus. Heck, I managed to do it with VBA: Enhanced Document Properties
The key is finding/access that schema that defines the ContentType and see if there exists or can be created the types missing (combobox, richtext, picture and checkbox). It seems achievable but I'm just wondering in the wilderness ;-)
Greg,
What is at: https://TheAnchorage/UserDefinedProperties?
Where might one find documentation on creating user defined properties? Would this be the starting point? Walkthrough: Bind content controls to custom XML parts
(I did not find it there.)
This does, indeed, look promising.
I created files from your post and using the Mapping control imported them, the xml file first.
I got:
Both the SSN and Typist are subject to validation.
Here are temporary links to the files I used:
These were based on your previous post.
Through trial and error, I am having some success. Here is an XML and XSD script that will add three items to the Document Property Menu:
Client Age
Client SSN
Typist (Initials Only)
.... and will validate the age to a number between 1 and 120, the SSN in the format ###-##-#### and the Typists as 2 - 3 capital letters.
<?xml version="1.0" encoding="utf-8"?>
<p:properties xmlns:p="http://schemas.microsoft.com/office/2006/metadata/properties" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserDefinedProperties>
<ClientAge xmlns="https://TheAnchorage/UserDefinedProperties"/>
<ClientSSN xmlns="https://TheAnchorage/UserDefinedProperties">###-##-####</ClientSSN>/>
<Typist xmlns="https://TheAnchorage/UserDefinedProperties"/>
</UserDefinedProperties>
</p:properties>
<?xml version="1.0"?>
<ct:contentTypeSchema xmlns:ct="http://schemas.microsoft.com/office/2006/metadata/contentType" xmlns:ma="http://schemas.microsoft.com/office/2006/metadata/properties/metaAttributes">
<xsd:schema targetNamespace="http://schemas.microsoft.com/office/2006/metadata/properties" ma:root="true" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:p="http://schemas.microsoft.com/office/2006/metadata/properties" xmlns:ns2="https://TheAnchorage/UserDefinedProperties">
<xsd:import namespace="https://TheAnchorage/UserDefinedProperties"/>
<xsd:element name="properties">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="documentManagement">
<xsd:complexType>
<xsd:all>
<xsd:element ref="ns2:ClientAge" minOccurs="0"/>
<xsd:element ref="ns2:ClientSSN" minOccurs="0"/>
<xsd:element ref="ns2:Typist" minOccurs="0"/>
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema targetNamespace="https://TheAnchorage/UserDefinedProperties" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dms="http://schemas.microsoft.com/office/2006/documentManagement/types">
<xsd:import namespace="http://schemas.microsoft.com/office/2006/documentManagement/types"/>
<xsd:element name="ClientAge" nillable="true" ma:displayName="Client Age" ma:default="" ma:hidden="false" ma:internalName="ClientAge" ma:readOnly="false">
<xsd:simpleType>
<!--- Some success. I've discoverd a Curreny base which will validate a number-->
<xsd:restriction base="dms:Currency">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="120"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="ClientSSN" nillable="true" ma:displayName="Client SSN" ma:default="###-##-####" ma:hidden="false" ma:internalName="CientSSN" ma:readOnly="false">
<xsd:simpleType>
<!--- More success. I've discoverd the pattern restrctions defined for the W3 schools "sting" data type works-->
<!--- This validates as nine digit SSN in the form ###-##-####-->
<xsd:restriction base="dms:Text">
<xsd:pattern value="[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Typist" nillable="true" ma:displayName="Typist (Initials Only)" ma:default="" ma:hidden="false" ma:internalName="Typist" ma:readOnly="false">
<xsd:simpleType>
<!--- Validates 2 to 3 capital letters-->
<xsd:restriction base="dms:Text">
<xsd:pattern value="([A-Z])*"/>
<xsd:minLength value="2"/>
<xsd:maxLength value="3"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:schema>
</ct:contentTypeSchema>
It seems that the "dms" namespace base:"Text" corresponds with the W3 Schools datatype base:"string" and the "dms" namespace base:"Currency" is loosely associated the W3 Schools datatype base:"integer"
There seems to be some real possibility here for customizing the Document Property menu. Hopefully someone will come along with the keys to the kingdom (and lift the veil form the dms namespace datetypes "base" structure)