OneMore
OneMore copied to clipboard
Fit Grid to Text command
Problem to Solve
Hi, umm, the problem is a bit difficult to reproduce but the error seems pretty straightforward:
Using the Fit Grid to Text command does nothing for me. Interestingly (sometimes) opening the command palette thereafter gives the following error (translated):
Message: The value 134.27734375 is invalid for Value. Value should be between 'Minimum' and 'Maximum'. Parameter name: Value
Full log:
01|10:11:28.535| Starting dllhost 12172, 1103 Mhz, 16 MB, en-US/en-US, v6.2.1, OneNote 15.0, Office 16.0, 2024-04-25 22:11
01|10:11:28.535| ..Windows 11 Professional, Version 23H2, Build 22621, 64 bit
01|10:11:28.535| ..C:\Program Files\Microsoft Office\root\Office16\ONENOTE.EXE (16.0.17425.20176)
01|10:11:28.547| ..OnConnection(ConnectionMode:ext_cm_Startup,custom[1:Int32])
01|10:11:28.547| ..OneAddInsUpdate(custom[])
01|10:11:28.965| ..building ribbon
01|10:11:28.972| ..building ribbon colorizer commands
01|10:11:29.112| ..building ribbon language proofing commands
01|10:11:29.115| ..building ribbon groups
01|10:11:29.119| ..building context menu
01|10:11:29.119| ..building context menu search engines
01|10:11:29.212| ..OnStartupComplete(custom[])
01|10:11:29.214| ..starting command service
01|10:11:29.215| ..starting reminder service
01|10:11:29.215| ..starting navigation service
01|10:11:29.220| ..starting hashtag service, Ready
01|10:11:29.222| ..ready
08|10:11:29.228| hashtag service waiting, Ready
10|10:11:29.234| Running command UpdateCommand
11|10:11:29.462| ..defined 47 hotkeys for input locale 1031
11|10:11:35.685| Running command FitGridToTextCommand
19|10:11:43.857| ..Running command FitGridToTextCommand
20|10:11:49.275| ..Running command FitGridToTextCommand
10|10:11:59.472| ..Running command FitGridToTextCommand
10|10:12:10.612| Running command FitGridToTextCommand
20|10:12:14.762| ..Running command CommandPaletteCommand
20|10:12:14.795| ..discovered 171 commands, 5 mru
04|10:12:14.975| Error running command FitGridToTextCommand
04|10:12:14.975| System.ArgumentOutOfRangeException
Message: Der Wert 134,27734375 ist für Value ungültig. Value sollte zwischen 'Minimum' und 'Maximum' liegen.
Parametername: Value
Source: System.Windows.Forms
StackTrace: bei System.Windows.Forms.NumericUpDown.set_Value(Decimal value)
bei River.OneMoreAddIn.Commands.FitGridToTextDialog..ctor(String fontSize, Double spacing)
bei River.OneMoreAddIn.Commands.FitGridToTextCommand.<Execute>d__1.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bei River.OneMoreAddIn.Commands.FitGridToTextCommand.<Execute>d__1.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
bei System.Runtime.CompilerServices.TaskAwaiter.GetResult()
bei River.OneMoreAddIn.CommandFactory.<Run>d__5.MoveNext()
TargetSite: [System.Windows.Forms] System.Windows.Forms.NumericUpDown::set_Value()
To Reproduce
What seems clear is that the command does nothing. Not 100% sure how to get the error message. After a couple of calls to the command, switching between pages and en-/disabling grids or lines and then acitvating the command palette, the error message usually appears.
Thanks for looking into this!
It should do this:
But I'll take a look at the max/min range error. I think it just needs rounding.
By the way, this fit algorithm is not exact. Page grid have to be symmetric across the entire page. So it looks for the "most common font" on the page and adjusts according to that, which means some lines may not fit perfectly.
Thanks!
I suppose as long as no headings etc. are used it should work fine. Probably it would even be possible to make headings work by setting their font size to a multiple of the line height - let's say double. But I don't know how to do that, unfortunately.