共用方式為


Mapping Element (Document Icons)

Applies to: SharePoint Foundation 2010

Used in the DocIcon.xml file to map particular document types to their respective icons.

<Mapping
  Key = "Text"
  Value = "Text">
  EditText = "Text"
  OpenControl = "Text"
</Mapping>

Attributes

Attribute

Description

Key

Required Text. Specifies either a ProgID or a file name extension.

Value

Required Text. Specifies the image file name and extension. The file must exist in the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\IMAGES folder.

EditText

Optional Text. Specifies text that displays in drop-down menus as the editing item ("Edit in Application Name") for a file that has been uploaded to a list.

OpenControl

Optional Text. Specifies the name of the ActiveX control used to open the type of document.

Child Elements

None

Parent Elements

ByExtension, ByProgID

Occurrences

Minimum: 0

Maximum: Unbounded

Example

The following example maps ProgIDs and file name extensions as follows:

  • For different values of the ProgID <META> tag, it maps ProgIDs to the icons representing the applications. For example, "Excel.Sheet" maps to ichtmxls.gif.

  • It maps file name extensions to appropriate icons. For example, "docx" maps to icdocx.png.

  • If neither of the above causes a match, it provides a default value, icgen.gif, for the mapping.

<DocIcons>
  <ByProgID>
    <Mapping Key="Excel.Sheet" Value="ichtmxls.gif" EditText="Microsoft Excel" OpenControl="SharePoint.OpenDocuments" />
    <Mapping Key="PowerPoint.Slide" Value="ichtmppt.gif" EditText="Microsoft PowerPoint" OpenControl="SharePoint.OpenDocuments" />
    <Mapping Key="Word.Document" Value="ichtmdoc.gif" EditText="Microsoft Word" OpenControl="SharePoint.OpenDocuments"/>
  </ByProgID>
  <ByExtension>
    <Mapping Key="docx" Value="icdocx.png" EditText="Microsoft Word" OpenControl="SharePoint.OpenDocuments"/>
    <Mapping Key="pptx" Value="icpptx.png" EditText="Microsoft PowerPoint" OpenControl="SharePoint.OpenDocuments"/>
    <Mapping Key="xlsx" Value="icxlsx.png" EditText="Microsoft Excel" OpenControl="SharePoint.OpenDocuments"/>
    <Mapping Key="zip" Value="iczip.gif" OpenControl=""/>
  </ByExtension>
  <Default>
    <Mapping Value="icgen.gif"/>
  </Default>
</DocIcons>