Repository navigation
Closed
Labels
Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Enginecore PowerShell engine, interpreter, and runtime
Description
Hello everybody, i am encountering an issue.
I need to convert some old XML files (encoded with word 2006 .xml schema) as PDF.
I already used PowerShell and ComObject to do this on a Windows system :
$word = New-Object -ComObject Word.Application
$word.Documents.Open($filename).SaveAs($filename.replace(".xml", ".pdf"), 17)but now I have to automate this process on a Linux system (every XML files are generated onto).
PowerShell on Linux able to me to use these commands but not ComObject due to a missing of api-ms-win-core-com-l1-1-0.dll
Is there any way to load this dll into a Linux system ? If not, is there any other way to do the same ?
Command
$word = New-Object -ComObject Word.ApplicationExpected behavior
Actual behavior
New-Object : Unable to load DLL 'api-ms-win-core-com-l1-1-0.dll': The specified module or one of its dependencies could not be found.
(Exception from HRESULT: 0x8007007E)
At line:1 char:9
+ $word = New-Object -ComObject Word.application
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-Object], DllNotFoundException
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.NewObjectCommandEnvironment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-beta
PSEdition Core
GitCommitId v6.0.0-beta.7
OS Linux 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Enginecore PowerShell engine, interpreter, and runtime
Activity
iSazonov commentedon Sep 22, 2017
Jeremy Bidet (@JeremyBidet) Thanks for your report!
Unix systems don't support COM. You could use remoting from Unix to Windows system.
We should return more user-friendly message.
/cc Dongbo Wang (@daxian-dbw)
JeremyBidet commentedon Sep 22, 2017
Thanks to you Ilya (@iSazonov) for your feedback
[-]Using ComObject Word.Application[/-][+]Using ComObject Word.Application on Linux should have better error message[/+]SteveL-MSFT commentedon Sep 22, 2017
Reopening this to have better error message
[-]Using ComObject Word.Application on Linux should have better error message[/-][+]Using ComObject Word.Application on Linux[/+]daxian-dbw commentedon Sep 22, 2017
Or to not expose
-ComObjecton Unix plats?SteveL-MSFT commentedon Sep 22, 2017
daxian, even better!
[-]Using ComObject Word.Application on Linux[/-][+]-ComObject should not be exposed on systems where it is not supported[/+]