PScribo
PScribo copied to clipboard
Header and Footer
Hi, Do you plan to add Header and Footer option to the module?
BR, Itamar
Hi @itamartz - Yes at some point, time permitting.
Hi, Any News regrds Header and Footer?
BR, Itamar
@itamartz I've managed to catch up on the backlog of issues and this one is next on the list (finally!). Do you still want/need this functionality and do you have any particular requirements?
- Would a single header/footer throughout the document (with an option to not include the first page) be sufficient? This should be fairly simple to implement.
- Would you need a different header/footer per "section". This would be a lot more complicated to implement and take longer.
An example DSL implementation:
Document Example {
Style -Name Centered -Align Center
Header MyCustomHeader {
Paragraph 'My Custom Heading' -Style Centered
}
Paragraph ...
Table ....
Footer MyCustomFooter {
Paragraph 'Page $[PageNumber] of $[TotalPages]' -Style Centered
}
}
Thanks, Iain
One header is fine, without the first page. Also allow to put table in the header/fotter and page numbers.
Tnx
On Thu, Mar 5, 2020, 22:31 Iain Brighton [email protected] wrote:
@itamartz https://github.com/itamartz I've managed to catch up on the backlog of issues and this one is next on the list (finally!). Do you still want/need this functionality and do you have any particular requirements?
- Would a single header/footer throughout the document (with an option to not include the first page) be sufficient? This should be fairly simple to implement.
- Would you need a different header/footer per "section". This would be a lot more complicated to implement and take longer.
An example DSL implementation:
Document Example { Style -Name Centered -Align Center Header MyCustomHeader { Paragraph 'My Custom Heading' -Style Centered }
Paragraph ... Table .... Footer MyCustomFooter { Paragraph 'Page $[PageNumber] of $[TotalPages]' -Style Centered }
}
Thanks, Iain
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iainbrighton/PScribo/issues/80?email_source=notifications&email_token=ACNZ6J2BZZPOL7BZKWPWXLLRGADZ3A5CNFSM4FM2YYTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN6ZF7A#issuecomment-595432188, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNZ6JZMAE2IIWYLAS636W3RGADZ3ANCNFSM4FM2YYTA .
My vote is for option 1. Option to have separate first page header/footer, and page numbers would be ideal.
@iainbrighton Hi, Any progress regrds this?
BR, Itamar
@itamartz It's pretty much done! I've pushed my working branch so you can take a look. I won't merge this into dev until the current dev code is published as people are asking for this to be done soon.
Check out the new examples and take them for a spin. Let me know if you see any strange behaviour!
Hi, I play with this, and is fine but how I can enter the path for the file for example with out putting a text infront, Or Add a Image \ Logo without the text before.
BR, Itamar
On Thu, Mar 26, 2020 at 4:23 PM Iain Brighton [email protected] wrote:
@itamartz https://github.com/itamartz It's pretty much done! I've pushed my working branch https://github.com/iainbrighton/PScribo/tree/Issue80 so you can take a look. I won't merge this into dev until the current dev code is published as people are asking for this to be done soon.
Check out the new examples and take them for a spin. Let me know if you see any strange behaviour!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iainbrighton/PScribo/issues/80#issuecomment-604459643, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNZ6J6CNAELPSLEQ6TU4T3RJNQOJANCNFSM4FM2YYTA .
@itamartz There is no support for images in headers/footers and I don't think there ever will be. To do so would require being able to have PScribo tables support images.
I'm not sure I understand the file path question. It's just PowerShell so you should be able to grab the filename from the $PSCommandPath
environment variable, e.g.
Document FilenameExample {
Header -Default {
Paragraph "Filename: $PSCommandPath"
}
}
~\Desktop\Document.ps1
[CmdletBinding()]
param
(
[Parameter()]
[ValidateNotNullOrEmpty()]
[String] $StylePath
)
Document CallScopes {
# Set Document Style
if ($StylePath) {
.$StylePath
}
& "$PSScriptRoot\Report.ps1" -StylePath $StylePath
}
~\Desktop\Report.ps1
[CmdletBinding()]
param
(
[String] $StylePath
)
## Report.ps1
# If custom style not set, use default style
if (!$StylePath) {
& "$PSScriptRoot\DefaultStyles.ps1"
}
Section Test {
Paragraph 'Test Paragraph'
}
~\DefaultStyles.ps1
## DefaultStyles.ps1
Header -Default -IncludeOnFirstPage -ScriptBlock {
Paragraph 'Default Header'
}
Footer -Default -IncludeOnFirstPage -ScriptBlock {
Paragraph 'Default Footer'
}
~\Desktop\Styles.ps1
## Styles.ps1
Header -Default -IncludeOnFirstPage -ScriptBlock {
Paragraph 'Custom Header'
}
Footer -Default -IncludeOnFirstPage -ScriptBlock {
Paragraph 'Custom Footer'
}
Running this results in no error?
C:\Users\Iain> ~\Desktop\Document.ps1 -Verbose
Id : CALLSCOPES
Type : PScribo.Document
Name : CallScopes
Sections : {@{Id=1c1b72ea-24cd-4da9-897b-75e9a8625d15; Level=0; Number=1; Name=Test; Type=PScribo.Section;
Style=; Tabs=0; IsExcluded=False; Sections=System.Collections.ArrayList; Orientation=Portrait;
IsSectionBreak=False; IsSectionBreakEnd=False}}
Options : {MarginBottom, MarginLeft, PageOrientation, MarginRight...}
Properties : {TableStyles, Paragraphs, Sections, Styles...}
Styles : {Caption, TOC, Heading4, Heading2...}
TableStyles : {TableDefault}
NumberStyles : {Number, Roman, Letter}
Lists : {}
DefaultStyle : Normal
DefaultTableStyle : TableDefault
DefaultNumberStyle : Number
Header : @{HasFirstPageHeader=False; HasDefaultHeader=False; FirstPageHeader=; DefaultHeader=}
Footer : @{HasFirstPageFooter=False; HasDefaultFooter=False; FirstPageFooter=; DefaultFooter=}
TOC : {@{Id=1c1b72ea-24cd-4da9-897b-75e9a8625d15; Number=1; Level=0; Name=Test}}