-
-
Notifications
You must be signed in to change notification settings - Fork 34
Add-WordList ignores -Paragraph parameter #74
Comments
Ye, I can confirm this. Given that I am working on completely new module I am not sure if I will be fixing this. |
What I can suggest tho is to use Documentimo approach which is builtin into PSWriteWord Documentimo -FilePath $PSScriptRoot\Documentimo-BasicList.docx {
DocList {
DocListItem -Text 'Test 1' -Level 1
DocListItem -Text 'Test 1' -Level 2
DocListItem -Text 'Test 1' -Level 2
}
DocText -LineBreak
} -Open $TableDesigns = [Xceed.Document.NET.TableDesign].GetEnumNames()
$TableData = @{
Name = 'Test'
Value = 'Showing design'
Company = 'Evotec'
Module = 'Documentimo'
'Best Module' = 'PSWriteWord'
}
Documentimo -FilePath "$PSScriptRoot\TableDesigns.docx" {
foreach ($Design in $TableDesigns) {
DocNumbering -Text "Table Design - $Design" -Level 1 -Type Numbered -Heading Heading1 {
DocTable -DataTable $TableData -Design $Design
}
}
} -Open And here's more complicated example: |
Thanks for the suggestion, but I don't see how I can use that to input it into a specific place in the document. I have two workarounds for other people that need to do something similar. One where you get a list object from New-WordList and use the InsertListAfterSelf on the document itself. This solution outputs it to a numbered list, even if you supply it with "-Type Bulleted". I don't know why.
The other one is where you loop through an array and adds them as text instead. Then sets that paragraph to style "Bulleted", I don't know if this is correct for English documents, because my document style is in my native language. This adds an actual bulleted list, but I didn't find any solution for creating indentation, since IdentLevel is ReadOnly.
|
You can actually try to fix that in the cmdlet itself - it shouldn't be very hard, but like I said - I wrote completely new .NET library https://github.com/EvotecIT/OfficeIMO I talk about it a bit here: https://twitter.com/PrzemyslawKlys/status/1496576889250582533 It's far superior and works on Windows / Linux and Mac. The PS version if it will be released under https://github.com/EvotecIT/PSWriteOffice but there's a lot of open points yet to make it workable. I will get complete control over .NET and PowerShell library so it will allow me to configure stuff that was not possible before. It has support for sections, headers, footers, lists, tables and even cover pages. But it requires more work on my side. |
Thanks for this great module!
I'm trying to add a list after a certain paragraph in a document. This works great for Add-WordText, but Add-WordList always puts the list at the end of the document.
Example Document:
Example Code:
Saved Document:
It does this even if I'm not adding any text. New-WordList have the same behavior. There aren't any examples with Add-WordList and the paragraph parameter, so am I doing something wrong?
The text was updated successfully, but these errors were encountered: