在不安装Word的情况下使用-ComObject Word.application [英] Use -ComObject Word.application without install Word
问题描述
我有一个使用"-ComObject Word.Application"的powershell脚本.我想在Windows服务器中使用它,但是它没有Word.现在,当我执行时,我会遇到此错误.
I have a powershell script which use "-ComObject Word.Application". I would like to use this in a windows server but it doesn't have Word. For now, when i execute , i have this error.
New-Object : La récupération de la fabrique de classes COM pour le composant avec le CLSID
{00000000-0000-0000-0000-000000000000} a échoué en raison de l'erreur
suivante: 80040154 Classe non enregistrée
(Exception de HRESULT : 0x80040154 (REGDB_E_CLASSNOTREG)).
Au caractère E:\BELAIRREC\Scripts\PowerShell\Doc2PDF.ps1:27 : 16
+ $Wrd = New-Object -ComObject Word.Application
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [New-Object],
COMException
+ FullyQualifiedErrorId :
NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand
我认为毫无疑问,因为未安装Word.有没有一种方法可以在不安装Word的情况下使用-ComObject Word.Application?
I think it's no doubt because Word is not installed. Is there a way to use -ComObject Word.Application without install Word ?
谢谢
推荐答案
根据您要执行的操作,您可能需要查看 Open-XML-PowerTools 是cmdlet的开源集合,可用于处理SDK更容易.
Depending on what you want to do, you might want to look at the OpenXML SDK, which is a free library from Microsoft that lets you manipulate Office documents without installing the Office products (though the SDK needs to be installed). The Open-XML-PowerTools is an open source collection of cmdlets that make working with the SDK easier.
这篇关于在不安装Word的情况下使用-ComObject Word.application的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!