Hi,
Is it possible to define a new custom toolbar key which is a shortcut to format->page style->scaling mode->fit on number of pages->1 ?.
Thanks
Hi,
Is it possible to define a new custom toolbar key which is a shortcut to format->page style->scaling mode->fit on number of pages->1 ?.
Thanks
Alternative?
Maintain one or more page styles prepared for expectable purposes in your respective template for spreadsheet documents. Then simply apply the wanted style via the âStylistâ (F11).
As far as I can tell the option canât be set via the customization dialog.
You need to create a âmacroâ for the purpose, and to bind it to a sensitive element. I would suggest to not use a button (FormControl), but a sensitive area (text or icon) of a toolbar. You surely know how to add elements to a toolbar, or to create an extra toolbar.
If you arenât familiar with macro programming, you can use the following code I wrote for you:
Sub setScaleToPages(Optional pPageStyleName As String, Optional pNumPages As Long)
REM Be aware of the fact that this is NOT just for the next printout, but persisting
REM with the document, and in case you use it for a template, also for derived documents.
If IsMissing(pNumPages) Then pNumPages = 1
doc = ThisComponent
If IsMissing(pPageStyleName) Then
actSheet = doc.CurrentController.ActiveSheet
pPageStyleName = actSheet.PageStyle
EndIf
docStyleFamilies = doc.StyleFamilies
docPageStyles = docStyleFamilies.getByName("PageStyles")
thePageStyle = docPageStyles.getByName(pPageStyleName)
thePageStyle.ScaleToPages = 1
End Sub
((Sorry. Automatic formatting by the âsoftwareâ used for this site didnât accept my choice. It shouldnât spoil the code itself, however.))
<edit datetimeabout="2022-07-05 10:00 UTC">
Missed to mention in the original answer that you should call the finally working Sub via an interposed Sub selecting and processing cases. It depends on the way the Sub is called what kind of parameter it gets passed (if any). Called from a menu item (or the>Macros>Run dialog) there is no parameter passed. A call from a toolbar passes an Integer telling what modifier keys were pressed, and called from a FormControl the Sub gets passed an event object. </edit>
???
I would expect âpreformatted textâ to be shown as IIIII enter/paste it.
You see, Iâm an ego-maniac.
Concerning the reserved words of StarBasic; EndIf is a lso accepted, and I prefer this variant.
BTW The above code was successfully tested under LibO V 7.3.3.2.
The built-in Markdown interpreter prefers its own rules with maniacal persistence. Otherwise, he will not agree to the recognition of LO Basic.
See also here.
Thank you.