Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Created document remains empty in powershell 7 #71

Closed
pierrecoach opened this issue Feb 20, 2022 · 1 comment
Closed

Created document remains empty in powershell 7 #71

pierrecoach opened this issue Feb 20, 2022 · 1 comment

Comments

@pierrecoach
Copy link

Issue : in Powershell 7 the document is created but content is not added

Expected result : the document is created and added text is present
Actual result : the document is created but remains empty

reproduction steps : see sequence below

PS>$wd = New-WordDocument -FilePath c:\temp\repro.docx
PS>Add-WordText -WordDocument $wd -Text "This is the title" -HeadingType Heading1

ParentContainer : None
ListItemType : Bulleted
Pictures : {}
Hyperlinks : {}
StyleName : Heading1
DocumentProperties : {}
Direction : LeftToRight
IndentationFirstLine : 0
IndentationHanging : 0
IndentationBefore : 0
IndentationAfter : 0
Alignment : left
Text : This is the title
MagicText : {Xceed.Document.NET.FormattedText}
FollowingTable :
LineSpacing : 12
LineSpacingBefore : 0
LineSpacingAfter : 0
ParagraphNumberProperties :
IsListItem : False
IndentLevel :
IsKeepWithNext : False
Xml : <w:p
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:pPr>
<w:pStyle w:val="Heading1" />
<w:ind />
</w:pPr>
<w:r>
<w:t>This is the title</w:t>
</w:r>
</w:p>
PackagePart : System.IO.Packaging.ZipPackagePart

PS>Save-WordDocument $wd

The document is created c:\temp\repro.docx
PS>ii C:\temp\repro.docx

--> repro.docx is present but empty

REMARK : from powershell_ise it worked well, and prom powershell version 5 too

configuration : windows 11 home edition 21H2 (OS Build 22000.526)

PROCESSOR_ARCHITECTURE AMD64
PROCESSOR_IDENTIFIER Intel64 Family 6 Model 140 Stepping 1, GenuineIntel

PS >$PSVersionTable

Name Value


PSVersion 7.2.1
PSEdition Core
GitCommitId 7.2.1
OS Microsoft Windows 10.0.22000
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

PS >get-module pswriteword # installed in current user scope

ModuleType Version PreRelease Name


Script 1.1.14 PSWriteWord

repro.docx

@PrzemyslawKlys
Copy link
Member

PrzemyslawKlys commented Feb 20, 2022

Yup, it's because libary doesn't support .NET Standard/.NET Core. They won't fix it, so this wont' be fixed.

However, I am working on a totally new PowerShell module which will work on Windows, Linux and MacOs including PS7.

It will have much more features and flexibility - but I'm currently working on .NET library before I dive into PowerShell.

Duplicate of: #34

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants