Ouvrir dans l'explorateur

Force file extension to match file type

Cette stratégie n'a pas de traduction française dans les modèles de l'éditeur ; le texte original est en anglais.

Type
Utilisateur
Chemin GPO
Configuration utilisateur › Stratégies › Modèles d'administration › Microsoft Excel 2016 › Options Excel › Sécurité EN : User Configuration › Policies › Administrative Templates › Microsoft Excel 2016 › Excel Options › Security
Pris en charge sur
At least Windows Server 2008 R2 or Windows 7
Fichier ADMX
excel16.admx
Nom interne
excel16/L_Forcefileextenstionstomatch

Explication

This policy setting controls how Excel loads file types that do not match their extension. Excel can load files with extensions that do not match the files' type. For example, if a comma-separated values (CSV) file named example.csv is renamed example.xls (or any other file extension supported by Excel 2003 and earlier only), Excel can properly load it as a CSV file.

If you enable this policy setting, you can choose from three options for working with files that have non-matching extensions:

- Allow different - Excel opens the files properly without warning users that the files have non-matching extensions. If users subsequently edit and save the files, Excel preserves both the true, underlying file format and the incorrect file extension.

- Allow different, but warn - Excel opens the files properly, but warns users about the file type mismatch. This option is the default configuration in Excel.

- Always match file type - Excel does not open any files that have non-matching extensions.

If you disable or do not configure this policy setting, if users attempt to open files with the wrong extension, Excel opens the file and displays a warning that the file type is not what Excel expected.

Registre

HKEY_CURRENT_USER\software\policies\microsoft\office\16.0\excel\security
Nom de la valeur
non défini dans l'ADMX

Valeurs d'activation / désactivation : non défini dans l'ADMX (voir les options ci-dessous).

PowerShell

Commandes PowerShell qui écrivent dans le registre ce que la stratégie écrirait. Les valeurs entre chevrons (<…>) sont à remplacer.

Écrire directement dans le registre contourne la stratégie de groupe : si une GPO gère cette valeur, elle sera réécrite au prochain gpupdate ; sinon la valeur reste en place (effet « tatouage »). Préférez une GPO ou, en local, LGPO.exe. Exécutez PowerShell en administrateur pour HKLM. Certaines stratégies demandent un redémarrage ou gpupdate /force.

Activer

# Activer : excel16/L_Forcefileextenstionstomatch
$k = 'HKCU:\software\policies\microsoft\office\16.0\excel\security'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
#
# Options possibles :
#   Allow different = 0
#   Allow different, but warn = 1
#   Always match file type = 2
Set-ItemProperty -Path $k -Name 'extensionhardening' -Value 1 -Type DWord

Désactiver

# Désactiver : excel16/L_Forcefileextenstionstomatch
# Aucune valeur n'est écrite à l'état « Désactivé » (rien de défini dans l'ADMX)

Revenir à « Non configuré »

# Revenir à « Non configuré » : excel16/L_Forcefileextenstionstomatch
$k = 'HKCU:\software\policies\microsoft\office\16.0\excel\security'
Remove-ItemProperty -Path $k -Name 'extensionhardening' -ErrorAction SilentlyContinue

Options (1)

LibelléContrôleValeur de registreType REGContraintes / détails
L_EmptyListe déroulanteenumextensionhardeningREG_DWORD
Choix par défaut (interface) : n° 1
LibelléValeur
Allow differentREG_DWORD = 0
Allow different, but warnREG_DWORD = 1
Always match file typeREG_DWORD = 2

Application

Microsoft 365 Apps / Office (Microsoft) — modèles de novembre 2026

Modèles officiels téléchargés le 12 novembre 2026.