Closed Tragen closed 4 years ago
@Tragen thanks for reporting. I'll need to take a look at this and try and work out what's going on. Obviously, Microsoft Word is a lot more tolerant of the underlying XML. I doubt it'll be an easy fix and require a lot of reverse engineering.
I minimized the example to
Document 'LibreOffice Error' { $services = Get-CimInstance -ClassName Win32_Service | Select-Object -Property DisplayName, State, StartMode | Sort-Object -Property DisplayName $services | Table -Columns DisplayName,State,StartMode -Headers 'Display Name','Status','Startup Type' -Width 0 } | Export-Document -Path $PSScriptRoot -Format Word -Verbose
When I press no to not load the document, I get this message
You can edit the document.xml and reformat the xml with linebreaks to get the correct location easier
@Tragen I've managed to get to the bottom of what is going on. Ultimately, LibreOffice doesn't support autofitting the table cell contents and the underlying document.xml
file has to define non-zero column widths. As a result, the code in PR #101 sets the width to 100% - Word will still automatically adjust the table width to fit the contents but results in a full-width table in Writer.
There are a couple of other "gotchas" that I've discovered with LibreOffice Writer whilst running through the examples:
\Examples\Example26.ps1
)\Examples\Example09.ps1
)Whilst these issues can probably be addressed, I'm not sure how much time/effort should be put into LibreOffice compatibility as it only appears to support the older 2006 Open Office XML specification. I've not heard of anyone else using LibreOffice to open PScribo documents, but I'm interested to hear your thoughts/use case.
When I create a document in Word format and I open it with LibreOffice, I get this error.
I can ignore it and the document looks okay. It doesn't matter which document I create, I used the examples to test it.