EvotecIT / PSWriteOffice

Experimental PowerShell Module to create and edit Microsoft Word, Microsoft Excel, and Microsoft PowerPoint documents without having Microsoft Office installed.
110 stars 9 forks source link

Get-OfficeWord error - Exception calling "Load" with "3" argument(s): "This isn't implemented yet?" #9

Closed v-bulynkin closed 1 year ago

v-bulynkin commented 1 year ago

Hello! I'm trying to read a simple .docx file which has been created in Onlyoffice and getting the following error:

WARNING: Get-OfficeWord - File C:\temp\hamlet.docx couldn't be open.
Error: Exception calling "Load" with "3" argument(s): "This isn't implemented yet?"

Is it critical to have only MS Word-created source documents and what is the problem in this case when there's nothing special in the .docx file?

PrzemyslawKlys commented 1 year ago

So this is related to me being "smart" and wanting to track what kind of functionality is not yet implemented. It's kind of useless because the word doc can be read and saved without having to know what it is.

This was fixed in:

But this library has not yet been updated to it. I need to sit down and resolve some conflicts and update library to new DLL which doesn't have this issue.

PrzemyslawKlys commented 1 year ago

I've checked and it seems the Hamlet document implements FoonoteProperties/EndnoteProperties:

v-bulynkin commented 1 year ago

OK, thanks! Maybe it would be useful to have a key like -SkipIncompatible to skip all not supported properties during reading or ignore those properties by default...

PrzemyslawKlys commented 1 year ago

No, it doesn't even make sense. It's complaining about those 2 entries

image

The thing is - unless you want to "change them" with PSWriteOffice or OfficeIMO you can use both and never notice there is an issue.

The only time it matters if we add/move/change sections and initially it was a problem

image

But we changed it that simply if it's not one of those things we don't support we simply clone them on the move and that's it. so unless you are after setting those settings, you can just ignore. And if you are a Developer there's "Debug" option where you will see this error now/

v-bulynkin commented 1 year ago

Could you really import this file?

PS C:\temp> $doc = Get-OfficeWord "C:\temp\hamlet.docx"
WARNING: Get-OfficeWord - File C:\temp\hamlet.docx couldn't be open. Error: Exception calling "Load" with "3" argument(s): "This isn't implemented yet?"

PS C:\temp> $doc.GetType()
You cannot call a method on a null-valued expression.
str:1 char:1
+ $doc.GetType()
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
PrzemyslawKlys commented 1 year ago

Not in PSWriteOffice current version... it needs to be updated. Current PSWriteOffice is based on 0.4.0 of OfficeIMO. While OfficeIMO is on 0.4.8 version now, soon to be on 0.4.9 with more features: https://github.com/EvotecIT/OfficeIMO/releases

The exception was removed on 0.4.7 version

v-bulynkin commented 1 year ago

Ah, now I see. Well, waiting for the next version and thanks for this great module!